class SyntaxTree::YARV::OptPlus
### Summary
‘opt_plus` is a specialization of the `opt_send_without_block` instruction that occurs when the `+` operator is used. There are fast paths for if both operands are integers, floats, strings, or arrays. It pops both the receiver and the argument off the stack and pushes on the result.
### Usage
~~~ruby 2 + 3 ~~~
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4115 def initialize(calldata) @calldata = calldata end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4131 def ==(other) other.is_a?(OptPlus) && other.calldata == calldata end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4151 def call(vm) canonical.call(vm) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4147 def canonical Send.new(calldata, nil) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4127 def deconstruct_keys(_keys) { calldata: calldata } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4119 def disasm(fmt) fmt.instruction("opt_plus", [fmt.calldata(calldata)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4123 def to_a(_iseq) [:opt_plus, calldata.to_h] end