Class: Rubinius::ToolSet.current::TS::AST::ConcatArgs
- Defined in:
- lib/rubinius/ast/values.rb
Instance Attribute Summary collapse
-
#array ⇒ Object
Returns the value of attribute array.
-
#rest ⇒ Object
Returns the value of attribute rest.
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(line, array, rest) ⇒ ConcatArgs
constructor
A new instance of ConcatArgs.
-
#peel_lhs ⇒ Object
Dive down and try to find an array of regular values that could construct the left side of a concatination.
- #splat? ⇒ Boolean
- #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, array, rest) ⇒ ConcatArgs
Returns a new instance of ConcatArgs.
30 31 32 33 34 |
# File 'lib/rubinius/ast/values.rb', line 30 def initialize(line, array, rest) @line = line @array = array @rest = rest end |
Instance Attribute Details
#array ⇒ Object
Returns the value of attribute array.
28 29 30 |
# File 'lib/rubinius/ast/values.rb', line 28 def array @array end |
#rest ⇒ Object
Returns the value of attribute rest.
28 29 30 |
# File 'lib/rubinius/ast/values.rb', line 28 def rest @rest end |
Instance Method Details
#bytecode(g) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rubinius/ast/values.rb', line 36 def bytecode(g) if @array @array.bytecode(g) @rest.bytecode(g) g.cast_array g.send :+, 1 else @rest.bytecode(g) g.cast_array end end |
#peel_lhs ⇒ Object
Dive down and try to find an array of regular values that could construct the left side of a concatination. This is used to minimize the splat doing a send.
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rubinius/ast/values.rb', line 51 def peel_lhs case @array when ConcatArgs @array.peel_lhs when ArrayLiteral ary = @array.body @array = nil ary else nil end end |
#splat? ⇒ Boolean
68 69 70 |
# File 'lib/rubinius/ast/values.rb', line 68 def splat? true end |
#to_sexp ⇒ Object
64 65 66 |
# File 'lib/rubinius/ast/values.rb', line 64 def to_sexp [:argscat, @array.to_sexp, @rest.to_sexp] end |