Class: Rubinius::AST::SendFastMath

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

Overview

Emits fast VM instructions for certain methods.

Constant Summary collapse

Operators =
{
  :+    => :meta_send_op_plus,
  :-    => :meta_send_op_minus,
  :==   => :meta_send_op_equal,
  :===  => :meta_send_op_tequal,
  :<    => :meta_send_op_lt,
  :>    => :meta_send_op_gt
}

Instance Attribute Summary collapse

Attributes inherited from SendWithArguments

#arguments

Attributes inherited from Send

#block, #check_for_local, #name, #privately, #receiver, #variable

Attributes inherited from Node

#line

Class Method Summary collapse

Methods inherited from SendWithArguments

#arguments_sexp, #initialize

Methods inherited from Send

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

Methods inherited from Node

#ascii_graph, #attributes, #children, #initialize, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, node_name, #pos, #set_child, #to_sexp, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #visit, #walk

Constructor Details

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

Instance Attribute Details

#operatorObject

Returns the value of attribute operator.



193
194
195
# File 'lib/compiler/ast/transforms.rb', line 193

def operator
  @operator
end

Class Method Details

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

Returns:

  • (Boolean)


184
185
186
187
188
189
190
191
# File 'lib/compiler/ast/transforms.rb', line 184

def self.match?(line, receiver, name, arguments, privately)
  return false unless op = Operators[name]
  if match_arguments? arguments, 1
    node = new line, receiver, name, arguments
    node.operator = op
    node
  end
end