Class: Rubinius::ToolSet.current::TS::AST::SendWithArguments

Inherits:
Send
  • Object
show all
Defined in:
lib/rubinius/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.



134
135
136
137
138
# File 'lib/rubinius/ast/sends.rb', line 134

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

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



132
133
134
# File 'lib/rubinius/ast/sends.rb', line 132

def arguments
  @arguments
end

Instance Method Details

#arguments_sexp(name = :arglist) ⇒ Object



157
158
159
160
161
# File 'lib/rubinius/ast/sends.rb', line 157

def arguments_sexp(name=:arglist)
  sexp = [name] + @arguments.to_sexp
  sexp << @block.to_sexp if @block
  sexp
end

#bytecode(g) ⇒ Object



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/rubinius/ast/sends.rb', line 140

def bytecode(g)
  @receiver.bytecode(g)
  @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