Class: CodeTools::AST::GlobalVariableAssignment

Inherits:
VariableAssignment show all
Defined in:
lib/rubinius/code/ast/variables.rb

Instance Attribute Summary

Attributes inherited from VariableAssignment

#name, #value

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from VariableAssignment

#defined, #initialize, #to_sexp

Methods inherited from Node

#ascii_graph, #attributes, #children, #defined, #initialize, 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

This class inherits a constructor from CodeTools::AST::VariableAssignment

Instance Method Details

#bytecode(g) ⇒ Object



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/rubinius/code/ast/variables.rb', line 311

def bytecode(g)
  # @value can be nil if this is coming via an masgn, which means
  # the value is already on the stack.
  if @name == :$!
    g.push_self
    @value.bytecode(g) if @value
    pos(g)
    g.send :raise, 1, true
  else
    pos(g)
    g.push_rubinius
    g.find_const :Globals
    if @value
      g.push_literal @name
      @value.bytecode(g)
    else
      g.swap
      g.push_literal @name
      g.swap
    end
    pos(g)
    g.send :[]=, 2
  end
end

#sexp_nameObject



336
337
338
# File 'lib/rubinius/code/ast/variables.rb', line 336

def sexp_name
  :gasgn
end