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.



802
803
804
805
# File 'lib/rubinius/code/ast/definitions.rb', line 802

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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



800
801
802
# File 'lib/rubinius/code/ast/definitions.rb', line 800

def name
  @name
end

Instance Method Details

#bytecode(g) ⇒ Object



807
808
809
810
811
812
813
814
815
816
817
818
819
# File 'lib/rubinius/code/ast/definitions.rb', line 807

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