class SyntaxTree::YARV::OptSize
### Summary
‘opt_size` is a specialization of `opt_send_without_block`, when the `size` method is called. There are fast paths when the receiver is either a string, hash, or array. It pops the receiver off the stack and pushes on the result.
### Usage
~~~ruby “”.size ~~~
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4284 def initialize(calldata) @calldata = calldata end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4300 def ==(other) other.is_a?(OptSize) && other.calldata == calldata end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4320 def call(vm) canonical.call(vm) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4316 def canonical Send.new(calldata, nil) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4296 def deconstruct_keys(_keys) { calldata: calldata } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4288 def disasm(fmt) fmt.instruction("opt_size", [fmt.calldata(calldata)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4292 def to_a(_iseq) [:opt_size, calldata.to_h] end