Sha256: b9de595fffe27defcd0adf61a86cdd39d8f091fe168bc5b40592c58cfe3c4fbf

Contents?: true

Size: 983 Bytes

Versions: 29

Compression:

Stored size: 983 Bytes

Contents

# frozen_string_literal: true

class Code
  class Object
    class IdentifierList < List
      def call(**args)
        operator = args.fetch(:operator, nil)
        arguments = args.fetch(:arguments, List.new)
        context = args.fetch(:context)
        value = arguments.code_first

        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.chop,
                arguments: List.new([value])
              )
            end
          )

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

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
code-ruby-1.1.3 lib/code/object/identifier_list.rb
code-ruby-1.1.1 lib/code/object/identifier_list.rb
code-ruby-1.1.0 lib/code/object/identifier_list.rb
code-ruby-1.0.0 lib/code/object/identifier_list.rb
code-ruby-0.15.16 lib/code/object/identifier_list.rb
code-ruby-0.15.15 lib/code/object/identifier_list.rb
code-ruby-0.15.14 lib/code/object/identifier_list.rb
code-ruby-0.15.13 lib/code/object/identifier_list.rb
code-ruby-0.15.12 lib/code/object/identifier_list.rb
code-ruby-0.15.11 lib/code/object/identifier_list.rb
code-ruby-0.15.10 lib/code/object/identifier_list.rb
code-ruby-0.15.9 lib/code/object/identifier_list.rb
code-ruby-0.15.8 lib/code/object/identifier_list.rb
code-ruby-0.15.7 lib/code/object/identifier_list.rb
code-ruby-0.15.6 lib/code/object/identifier_list.rb
code-ruby-0.15.5 lib/code/object/identifier_list.rb
code-ruby-0.15.4 lib/code/object/identifier_list.rb
code-ruby-0.15.3 lib/code/object/identifier_list.rb
code-ruby-0.15.2 lib/code/object/identifier_list.rb
code-ruby-0.15.0 lib/code/object/identifier_list.rb