class SyntaxTree::YARV::OptAnd

### Summary

‘opt_and` is a specialization of the `opt_send_without_block` instruction that occurs when the `&` operator is used. There is a fast path for if both operands are integers. It pops both the receiver and the argument off the stack and pushes on the result.

### Usage

~~~ruby 2 & 3 ~~~

Attributes

calldata[R]

Public Class Methods

new(calldata) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2671
def initialize(calldata)
  @calldata = calldata
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2687
def ==(other)
  other.is_a?(OptAnd) && other.calldata == calldata
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2707
def call(vm)
  canonical.call(vm)
end
canonical() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2703
def canonical
  Send.new(calldata, nil)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2683
def deconstruct_keys(_keys)
  { calldata: calldata }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2675
def disasm(fmt)
  fmt.instruction("opt_and", [fmt.calldata(calldata)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2691
def length
  2
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2695
def pops
  2
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2699
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2679
def to_a(_iseq)
  [:opt_and, calldata.to_h]
end