Class: CodeTools::AST::LocalVariableAccess
Instance Attribute Summary
#variable
#name
Attributes inherited from Node
#line
Instance Method Summary
collapse
#placeholder?
Methods inherited from Node
#ascii_graph, #attributes, #children, 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, #visit, #walk
Constructor Details
Returns a new instance of LocalVariableAccess.
472
473
474
475
476
|
# File 'lib/rubinius/code/ast/variables.rb', line 472
def initialize(line, name)
@line = line
@name = name
@variable = nil
end
|
Instance Method Details
#bytecode(g) ⇒ Object
478
479
480
481
482
483
484
485
|
# File 'lib/rubinius/code/ast/variables.rb', line 478
def bytecode(g)
pos(g)
unless @variable
g.state.scope.assign_local_reference self
end
@variable.get_bytecode(g)
end
|
#defined(g) ⇒ Object
487
488
489
|
# File 'lib/rubinius/code/ast/variables.rb', line 487
def defined(g)
g.push_literal "local-variable"
end
|
#to_sexp ⇒ Object
495
496
497
|
# File 'lib/rubinius/code/ast/variables.rb', line 495
def to_sexp
[:lvar, @name]
end
|
#value_defined(g, f) ⇒ Object
491
492
493
|
# File 'lib/rubinius/code/ast/variables.rb', line 491
def value_defined(g, f)
bytecode(g)
end
|