Class: Rubinius::AST::For

Inherits:
Iter show all
Defined in:
lib/compiler/ast/sends.rb

Direct Known Subclasses

For19

Instance Attribute Summary

Attributes inherited from Iter

#arguments, #body, #parent

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Iter

#block_local?, #initialize, #module?, #new_local, #to_sexp

Methods included from Compiler::LocalVariables

#allocate_slot, #local_count, #local_names, #variables

Methods inherited from Node

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

Constructor Details

This class inherits a constructor from Rubinius::AST::Iter

Instance Method Details

#assign_local_reference(var) ⇒ Object



493
494
495
496
497
498
499
# File 'lib/compiler/ast/sends.rb', line 493

def assign_local_reference(var)
  unless reference = search_local(var.name)
    reference = new_nested_local var.name
  end

  var.variable = reference
end

#nest_scope(scope) ⇒ Object



476
477
478
# File 'lib/compiler/ast/sends.rb', line 476

def nest_scope(scope)
  scope.parent = self
end

#new_nested_local(name) ⇒ Object



487
488
489
490
491
# File 'lib/compiler/ast/sends.rb', line 487

def new_nested_local(name)
  reference = @parent.new_nested_local name
  reference.depth += 1
  reference
end

#search_local(name) ⇒ Object



480
481
482
483
484
485
# File 'lib/compiler/ast/sends.rb', line 480

def search_local(name)
  if reference = @parent.search_local(name)
    reference.depth += 1
    reference
  end
end

#sexp_nameObject



501
502
503
# File 'lib/compiler/ast/sends.rb', line 501

def sexp_name
  :for
end