Class: CodeTools::AST::AttributeAssignment
- Inherits:
-
SendWithArguments
- Object
- Node
- Send
- SendWithArguments
- CodeTools::AST::AttributeAssignment
- Defined in:
- lib/rubinius/code/ast/sends.rb
Instance Attribute Summary
Attributes inherited from SendWithArguments
Attributes inherited from Send
#block, #name, #privately, #receiver, #variable, #vcall_style
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(line, receiver, name, arguments) ⇒ AttributeAssignment
constructor
A new instance of AttributeAssignment.
- #sexp_name ⇒ Object
Methods inherited from SendWithArguments
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.
172 173 174 175 176 177 178 179 180 181 |
# File 'lib/rubinius/code/ast/sends.rb', line 172 def initialize(line, receiver, name, arguments) @line = line @receiver = receiver @privately = receiver.kind_of?(Self) ? true : false @name = :"#{name}=" @arguments = Arguments.new line, arguments end |
Instance Method Details
#bytecode(g) ⇒ Object
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/rubinius/code/ast/sends.rb', line 183 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_name ⇒ Object
206 207 208 |
# File 'lib/rubinius/code/ast/sends.rb', line 206 def sexp_name :attrasgn end |