Class: Rubinius::ToolSet.current::TS::AST::AttributeAssignment

Inherits:
SendWithArguments show all
Defined in:
lib/rubinius/ast/sends.rb

Instance Attribute Summary

Attributes inherited from SendWithArguments

#arguments

Attributes inherited from Send

#block, #name, #privately, #receiver, #variable, #vcall_style

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from SendWithArguments

#arguments_sexp

Methods inherited from Send

#arguments_sexp, #check_local_reference, #defined, #receiver_sexp, #to_sexp, #value_defined

Methods inherited from Node

#ascii_graph, #attributes, #children, #defined, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, #to_sexp, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk

Constructor Details

#initialize(line, receiver, name, arguments) ⇒ AttributeAssignment

Returns a new instance of AttributeAssignment.



165
166
167
168
169
170
171
172
173
174
# File 'lib/rubinius/ast/sends.rb', line 165

def initialize(line, receiver, name, arguments)
  @line = line

  @receiver = receiver
  @privately = receiver.kind_of?(Self) ? true : false

  @name = :"#{name}="

  @arguments = ActualArguments.new line, arguments
end

Instance Method Details

#bytecode(g) ⇒ Object



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/rubinius/ast/sends.rb', line 176

def bytecode(g)
  @receiver.bytecode(g)
  if g.state.masgn?
    g.swap
    g.send @name, 1, @privately
  else
    @arguments.bytecode(g)
    g.dup

    if @arguments.splat?
      g.move_down @arguments.size + 2
      g.swap
      g.push :nil
      g.send_with_splat @name, @arguments.size, @privately, true
    else
      g.move_down @arguments.size + 1
      g.send @name, @arguments.size, @privately
    end

    g.pop
  end
end

#sexp_nameObject



199
200
201
# File 'lib/rubinius/ast/sends.rb', line 199

def sexp_name
  :attrasgn
end