Class: CodeTools::AST::InstanceVariableAccess

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

Instance Attribute Summary

Attributes inherited from VariableAccess

#name

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from VariableAccess

#initialize, #value_defined

Methods inherited from Node

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

Constructor Details

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

Instance Method Details

#bytecode(g) ⇒ Object



424
425
426
427
428
# File 'lib/rubinius/code/ast/variables.rb', line 424

def bytecode(g)
  pos(g)

  g.push_ivar @name
end

#defined(g) ⇒ Object



437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/rubinius/code/ast/variables.rb', line 437

def defined(g)
  f = g.new_label
  done = g.new_label

  variable_defined(g, f)
  g.push_literal "instance-variable"
  g.goto done

  f.set!
  g.push_nil

  done.set!
end

#to_sexpObject



451
452
453
# File 'lib/rubinius/code/ast/variables.rb', line 451

def to_sexp
  [:ivar, @name]
end

#variable_defined(g, f) ⇒ Object



430
431
432
433
434
435
# File 'lib/rubinius/code/ast/variables.rb', line 430

def variable_defined(g, f)
  g.push_self
  g.push_literal @name
  g.send :__instance_variable_defined_p__, 1
  g.goto_if_false f
end