Class: CodeTools::AST::BlockArgument

Inherits:
Node
  • Object
show all
Includes:
LocalVariable
Defined in:
lib/rubinius/code/ast/definitions.rb

Instance Attribute Summary collapse

Attributes included from LocalVariable

#variable

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods included from LocalVariable

#placeholder?

Methods inherited from Node

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

#initialize(line, name) ⇒ BlockArgument

Returns a new instance of BlockArgument.



763
764
765
766
# File 'lib/rubinius/code/ast/definitions.rb', line 763

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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



761
762
763
# File 'lib/rubinius/code/ast/definitions.rb', line 761

def name
  @name
end

Instance Method Details

#bytecode(g) ⇒ Object



768
769
770
771
772
773
774
775
776
777
778
779
780
# File 'lib/rubinius/code/ast/definitions.rb', line 768

def bytecode(g)
  pos(g)

  g.push_proc

  if @variable.respond_to?(:depth) && @variable.depth != 0
    g.set_local_depth @variable.depth, @variable.slot
  else
    g.set_local @variable.slot
  end

  g.pop
end