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

Inherits:
Node
  • Object
show all
Defined in:
lib/rubinius/ast/sends.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

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, arguments) ⇒ For19Arguments

Returns a new instance of For19Arguments.



823
824
825
826
827
828
829
830
831
832
833
834
# File 'lib/rubinius/ast/sends.rb', line 823

def initialize(line, arguments)
  @line = line
  @arguments = arguments

  if @arguments.kind_of? MultipleAssignment
    @args = 0
    @splat = 0
  else
    @args = 1
    @splat = nil
  end
end

Instance Attribute Details

#block_indexObject (readonly)

Returns the value of attribute block_index.



821
822
823
# File 'lib/rubinius/ast/sends.rb', line 821

def block_index
  @block_index
end

Instance Method Details

#bytecode(g) ⇒ Object



836
837
838
839
840
841
842
843
844
845
846
847
848
849
# File 'lib/rubinius/ast/sends.rb', line 836

def bytecode(g)
  if @splat
    g.push_literal Compiler::Runtime
    g.push_local 0
    g.send :unwrap_block_arg, 1
  else
    g.push_local 0
  end

  g.state.push_masgn
  @arguments.bytecode(g)
  g.state.pop_masgn
  g.pop
end

#post_argsObject



859
860
861
# File 'lib/rubinius/ast/sends.rb', line 859

def post_args
  0
end

#required_argsObject



851
852
853
# File 'lib/rubinius/ast/sends.rb', line 851

def required_args
  @args
end

#splat_indexObject



863
864
865
# File 'lib/rubinius/ast/sends.rb', line 863

def splat_index
  @splat
end

#total_argsObject



855
856
857
# File 'lib/rubinius/ast/sends.rb', line 855

def total_args
  @args
end