Class: Rubinius::ToolSet.current::TS::AST::ElementAssignment
- Inherits:
-
SendWithArguments
- Object
- Node
- Send
- SendWithArguments
- Rubinius::ToolSet.current::TS::AST::ElementAssignment
- Defined in:
- lib/rubinius/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, arguments) ⇒ ElementAssignment
constructor
A new instance of ElementAssignment.
- #masgn_bytecode(g) ⇒ Object
- #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, arguments) ⇒ ElementAssignment
Returns a new instance of ElementAssignment.
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/rubinius/ast/sends.rb', line 205 def initialize(line, receiver, arguments) @line = line @receiver = receiver @privately = receiver.kind_of?(Self) ? true : false @name = :[]= case arguments when PushArgs @arguments = PushActualArguments.new arguments else @arguments = ActualArguments.new line, arguments end end |
Instance Method Details
#bytecode(g) ⇒ Object
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/rubinius/ast/sends.rb', line 229 def bytecode(g) return masgn_bytecode(g) if g.state.masgn? @receiver.bytecode(g) @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 |
#masgn_bytecode(g) ⇒ Object
221 222 223 224 225 226 227 |
# File 'lib/rubinius/ast/sends.rb', line 221 def masgn_bytecode(g) @receiver.bytecode(g) g.swap @arguments.masgn_bytecode(g) g.send @name, @arguments.size + 1, @privately # TODO: splat end |
#sexp_name ⇒ Object
249 250 251 |
# File 'lib/rubinius/ast/sends.rb', line 249 def sexp_name :attrasgn end |