Class: CodeTools::AST::CallCustom

Inherits:
SendWithArguments show all
Defined in:
lib/rubinius/code/ast/transforms.rb

Overview

Handles Rubinius.call_custom

Instance Attribute Summary

Attributes inherited from SendWithArguments

#arguments

Attributes inherited from Send

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

Attributes inherited from Node

#line

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SendWithArguments

#arguments_sexp, #initialize

Methods inherited from Send

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

Methods inherited from Node

#ascii_graph, #attributes, #children, #defined, #initialize, 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

This class inherits a constructor from CodeTools::AST::SendWithArguments

Class Method Details

.match?(line, receiver, name, arguments, privately) ⇒ Boolean

Returns:

  • (Boolean)


129
130
131
# File 'lib/rubinius/code/ast/transforms.rb', line 129

def self.match?(line, receiver, name, arguments, privately)
  match_send? receiver, :Rubinius, name, :call_custom
end

Instance Method Details

#bytecode(g) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/rubinius/code/ast/transforms.rb', line 133

def bytecode(g)
  if @arguments.splat?
    raise CompileError, "splat argument passed to call_custom"
  elsif @block
    raise CompileError, "block passed to call_custom"
  end

  pos(g)
  rec = @arguments.array.shift
  rec.bytecode(g)

  selector = @arguments.array.shift
  @arguments.bytecode(g)
  g.call_custom selector.value, @arguments.size
end