Sha256: aeca10926feb1390be45309b7e71886feb9a0d76f5f94fec8237b232013e323f

Contents?: true

Size: 1.02 KB

Versions: 34

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

class Code
  class Object
    class IdentifierList < List
      def self.name
        "IdentifierList"
      end

      def call(**args)
        operator = args.fetch(:operator, nil)
        arguments = args.fetch(:arguments, [])
        context = args.fetch(:context)
        value = arguments.first&.value

        case operator.to_s
        when /=$/
          sig(args) { Object }

          context = context.lookup!(raw.first)

          context =
            raw[..-2].reduce(context) do |context, identifier|
              context.code_fetch(identifier)
            end

          context.code_set(
            raw.last,
            if operator == "="
              value
            else
              context.fetch(raw.last).call(
                **args,
                operator: operator[..-2],
                arguments: [Argument.new(value)]
              )
            end
          )

          context.code_fetch(raw.last)
        else
          super
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
code-ruby-0.12.0 lib/code/object/identifier_list.rb
code-ruby-0.11.0 lib/code/object/identifier_list.rb
code-ruby-0.10.4 lib/code/object/identifier_list.rb
code-ruby-0.10.3 lib/code/object/identifier_list.rb
code-ruby-0.10.2 lib/code/object/identifier_list.rb
code-ruby-0.10.1 lib/code/object/identifier_list.rb
code-ruby-0.10.0 lib/code/object/identifier_list.rb
code-ruby-0.9.3 lib/code/object/identifier_list.rb
code-ruby-0.9.2 lib/code/object/identifier_list.rb
code-ruby-0.9.1 lib/code/object/identifier_list.rb
code-ruby-0.9.0 lib/code/object/identifier_list.rb
code-ruby-0.8.5 lib/code/object/identifier_list.rb
code-ruby-0.8.4 lib/code/object/identifier_list.rb
code-ruby-0.8.3 lib/code/object/identifier_list.rb
code-ruby-0.8.2 lib/code/object/identifier_list.rb
code-ruby-0.8.1 lib/code/object/identifier_list.rb
code-ruby-0.8.0 lib/code/object/identifier_list.rb
code-ruby-0.7.8 lib/code/object/identifier_list.rb
code-ruby-0.7.7 lib/code/object/identifier_list.rb
code-ruby-0.7.6 lib/code/object/identifier_list.rb