class SyntaxTree::YARV::OptOr
### Summary
‘opt_or` 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 4005 def initialize(calldata) @calldata = calldata end
Public Instance Methods
==(other)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4021 def ==(other) other.is_a?(OptOr) && other.calldata == calldata end
call(vm)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4041 def call(vm) canonical.call(vm) end
canonical()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4037 def canonical Send.new(calldata, nil) end
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4017 def deconstruct_keys(_keys) { calldata: calldata } end
disasm(fmt)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4009 def disasm(fmt) fmt.instruction("opt_or", [fmt.calldata(calldata)]) end
length()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4025 def length 2 end
pops()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4029 def pops 2 end
pushes()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4033 def pushes 1 end
to_a(_iseq)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4013 def to_a(_iseq) [:opt_or, calldata.to_h] end