Class: CodeTools::AST::DefaultArguments
- Defined in:
- lib/rubinius/code/ast/definitions.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#names ⇒ Object
Returns the value of attribute names.
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(line, block) ⇒ DefaultArguments
constructor
A new instance of DefaultArguments.
- #map_arguments(scope) ⇒ Object
- #to_sexp ⇒ Object
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, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Constructor Details
#initialize(line, block) ⇒ DefaultArguments
Returns a new instance of DefaultArguments.
589 590 591 592 593 594 |
# File 'lib/rubinius/code/ast/definitions.rb', line 589 def initialize(line, block) @line = line array = block.array @names = array.map { |a| a.name } @arguments = array end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
587 588 589 |
# File 'lib/rubinius/code/ast/definitions.rb', line 587 def arguments @arguments end |
#names ⇒ Object
Returns the value of attribute names.
587 588 589 |
# File 'lib/rubinius/code/ast/definitions.rb', line 587 def names @names end |
Instance Method Details
#bytecode(g) ⇒ Object
600 601 602 603 604 605 606 607 608 609 610 611 |
# File 'lib/rubinius/code/ast/definitions.rb', line 600 def bytecode(g) @arguments.each do |arg| done = g.new_label arg.variable.get_bytecode(g) g.goto_if_not_undefined done arg.bytecode(g) g.pop done.set! end end |
#map_arguments(scope) ⇒ Object
596 597 598 |
# File 'lib/rubinius/code/ast/definitions.rb', line 596 def map_arguments(scope) @arguments.each { |var| scope.assign_local_reference var } end |
#to_sexp ⇒ Object
613 614 615 |
# File 'lib/rubinius/code/ast/definitions.rb', line 613 def to_sexp @arguments.map { |x| x.to_sexp } end |