Class: Rubinius::AST::ActualArguments
- Defined in:
- lib/compiler/ast/sends.rb
Instance Attribute Summary collapse
-
#array ⇒ Object
Returns the value of attribute array.
-
#splat ⇒ Object
Returns the value of attribute splat.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(line, arguments = nil) ⇒ ActualArguments
constructor
A new instance of ActualArguments.
- #size ⇒ Object
- #splat? ⇒ Boolean
- #stack_size ⇒ Object
- #to_sexp ⇒ Object
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, arguments = nil) ⇒ ActualArguments
Returns a new instance of ActualArguments.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/compiler/ast/sends.rb', line 199 def initialize(line, arguments=nil) @line = line @splat = nil case arguments when SplatValue @splat = arguments @array = [] when ConcatArgs case arguments.array when ArrayLiteral @array = arguments.array.body @splat = SplatValue.new line, arguments.rest when PushArgs @array = [] node = SplatValue.new line, arguments.rest @splat = CollectSplat.new line, arguments.array, node else @array = [] @splat = CollectSplat.new line, arguments.array, arguments.rest end when PushArgs if arguments.arguments.kind_of? ConcatArgs if ary = arguments.arguments.peel_lhs @array = ary else @array = [] end else @array = [] end @splat = CollectSplat.new line, arguments.arguments, arguments.value when ArrayLiteral @array = arguments.body when nil @array = [] else @array = [arguments] end end |
Instance Attribute Details
#array ⇒ Object
Returns the value of attribute array.
197 198 199 |
# File 'lib/compiler/ast/sends.rb', line 197 def array @array end |
#splat ⇒ Object
Returns the value of attribute splat.
197 198 199 |
# File 'lib/compiler/ast/sends.rb', line 197 def splat @splat end |
Instance Method Details
#size ⇒ Object
241 242 243 |
# File 'lib/compiler/ast/sends.rb', line 241 def size @array.size end |
#splat? ⇒ Boolean
251 252 253 |
# File 'lib/compiler/ast/sends.rb', line 251 def splat? not @splat.nil? end |
#stack_size ⇒ Object
245 246 247 248 249 |
# File 'lib/compiler/ast/sends.rb', line 245 def stack_size size = @array.size size += 1 if splat? size end |
#to_sexp ⇒ Object
255 256 257 258 259 |
# File 'lib/compiler/ast/sends.rb', line 255 def to_sexp sexp = @array.map { |x| x.to_sexp } sexp << @splat.to_sexp if @splat sexp end |