Class: CodeTools::AST::SendWithArguments

Inherits:
Send
  • Object
show all
Defined in:
lib/rubinius/code/ast/sends.rb

Instance Attribute Summary collapse

Attributes inherited from Send

#block, #name, #privately, #receiver, #variable, #vcall_style

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Send

#check_local_reference, #defined, #receiver_sexp, #sexp_name, #to_sexp, #value_defined

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, receiver, name, arguments, privately = false) ⇒ SendWithArguments

Returns a new instance of SendWithArguments.



152
153
154
155
156
# File 'lib/rubinius/code/ast/sends.rb', line 152

def initialize(line, receiver, name, arguments, privately=false)
  super line, receiver, name, privately
  @block = nil
  @arguments = Arguments.new line, arguments
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



150
151
152
# File 'lib/rubinius/code/ast/sends.rb', line 150

def arguments
  @arguments
end

Instance Method Details

#arguments_sexp(name = :arglist) ⇒ Object



175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/rubinius/code/ast/sends.rb', line 175

def arguments_sexp(name=:arglist)
  sexp = [name]

  case @arguments
  when PushArguments
    sexp << @arguments.to_sexp
  else
    sexp += @arguments.to_sexp
  end

  sexp << @block.to_sexp if @block
  sexp
end

#bytecode(g, anddot = false) ⇒ Object



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/rubinius/code/ast/sends.rb', line 158

def bytecode(g, anddot=false)
  @receiver.bytecode(g) unless anddot
  @arguments.bytecode(g)

  pos(g)

  if @arguments.splat?
    @block ? @block.bytecode(g) : g.push_nil
    g.send_with_splat @name, @arguments.size, @privately, false
  elsif @block
    @block.bytecode(g)
    g.send_with_block @name, @arguments.size, @privately
  else
    g.send @name, @arguments.size, @privately
  end
end