Class: Rubinius::ToolSet.current::TS::AST::LocalVariableAccess

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

Instance Attribute Summary

Attributes included from LocalVariable

#variable

Attributes inherited from VariableAccess

#name

Attributes inherited from Node

#line

Instance Method Summary collapse

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

#initialize(line, name) ⇒ LocalVariableAccess

Returns a new instance of LocalVariableAccess.



474
475
476
477
478
# File 'lib/rubinius/ast/variables.rb', line 474

def initialize(line, name)
  @line = line
  @name = name
  @variable = nil
end

Instance Method Details

#bytecode(g) ⇒ Object



480
481
482
483
484
485
486
487
# File 'lib/rubinius/ast/variables.rb', line 480

def bytecode(g)
  pos(g)

  unless @variable
    g.state.scope.assign_local_reference self
  end
  @variable.get_bytecode(g)
end

#defined(g) ⇒ Object



489
490
491
# File 'lib/rubinius/ast/variables.rb', line 489

def defined(g)
  g.push_literal "local-variable"
end

#to_sexpObject



497
498
499
# File 'lib/rubinius/ast/variables.rb', line 497

def to_sexp
  [:lvar, @name]
end

#value_defined(g, f) ⇒ Object



493
494
495
# File 'lib/rubinius/ast/variables.rb', line 493

def value_defined(g, f)
  bytecode(g)
end