Class: CodeTools::AST::ForParameters
- Defined in:
- lib/rubinius/ast/sends.rb
Instance Attribute Summary collapse
-
#assignments ⇒ Object
Returns the value of attribute assignments.
-
#block_index ⇒ Object
Returns the value of attribute block_index.
-
#keywords ⇒ Object
Returns the value of attribute keywords.
-
#post_args ⇒ Object
Returns the value of attribute post_args.
-
#required_args ⇒ Object
(also: #total_args, #arity)
Returns the value of attribute required_args.
-
#splat_index ⇒ Object
Returns the value of attribute splat_index.
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(line, assignments) ⇒ ForParameters
constructor
A new instance of ForParameters.
- #map_arguments(scope) ⇒ 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, #to_sexp, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Constructor Details
#initialize(line, assignments) ⇒ ForParameters
Returns a new instance of ForParameters.
835 836 837 838 839 840 841 842 843 |
# File 'lib/rubinius/ast/sends.rb', line 835 def initialize(line, assignments) @line = line @assignments = assignments @splat_index = assignments.kind_of?(MultipleAssignment) ? 0 : nil @required_args = @splat_index ? 0 : 1 @post_args = 0 @keywords = nil @block_index = nil end |
Instance Attribute Details
#assignments ⇒ Object
Returns the value of attribute assignments.
832 833 834 |
# File 'lib/rubinius/ast/sends.rb', line 832 def assignments @assignments end |
#block_index ⇒ Object
Returns the value of attribute block_index.
832 833 834 |
# File 'lib/rubinius/ast/sends.rb', line 832 def block_index @block_index end |
#keywords ⇒ Object
Returns the value of attribute keywords.
832 833 834 |
# File 'lib/rubinius/ast/sends.rb', line 832 def keywords @keywords end |
#post_args ⇒ Object
Returns the value of attribute post_args.
832 833 834 |
# File 'lib/rubinius/ast/sends.rb', line 832 def post_args @post_args end |
#required_args ⇒ Object Also known as: total_args, arity
Returns the value of attribute required_args.
832 833 834 |
# File 'lib/rubinius/ast/sends.rb', line 832 def required_args @required_args end |
#splat_index ⇒ Object
Returns the value of attribute splat_index.
832 833 834 |
# File 'lib/rubinius/ast/sends.rb', line 832 def splat_index @splat_index end |
Instance Method Details
#bytecode(g) ⇒ Object
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 |
# File 'lib/rubinius/ast/sends.rb', line 855 def bytecode(g) map_arguments(g.state.scope) if @splat_index g.push_rubinius g.find_const :Runtime g.push_local 0 g.send :unwrap_block_arg, 1 else g.push_local 0 end g.state.push_masgn @assignments.bytecode(g) g.state.pop_masgn end |
#map_arguments(scope) ⇒ Object
848 849 850 851 852 853 |
# File 'lib/rubinius/ast/sends.rb', line 848 def map_arguments(scope) case @assignments when LocalVariable scope.assign_local_reference @assignments end end |