Class: Rubinius::AST::DefaultArguments

Inherits:
Node
  • Object
show all
Defined in:
lib/compiler/ast/definitions.rb

Instance Attribute Summary collapse

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, node_name, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #visit, #walk

Constructor Details

#initialize(line, block) ⇒ DefaultArguments

Returns a new instance of DefaultArguments.



407
408
409
410
411
412
# File 'lib/compiler/ast/definitions.rb', line 407

def initialize(line, block)
  @line = line
  array = block.array
  @names = array.map { |a| a.name }
  @arguments = array
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



405
406
407
# File 'lib/compiler/ast/definitions.rb', line 405

def arguments
  @arguments
end

#namesObject

Returns the value of attribute names.



405
406
407
# File 'lib/compiler/ast/definitions.rb', line 405

def names
  @names
end

Instance Method Details

#map_arguments(scope) ⇒ Object



414
415
416
# File 'lib/compiler/ast/definitions.rb', line 414

def map_arguments(scope)
  @arguments.each { |var| scope.assign_local_reference var }
end

#to_sexpObject



418
419
420
# File 'lib/compiler/ast/definitions.rb', line 418

def to_sexp
  @arguments.map { |x| x.to_sexp }
end