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
calldata[R]
Public Class Methods
new(calldata)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4231 def initialize(calldata) @calldata = calldata end
Public Instance Methods
==(other)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4247 def ==(other) other.is_a?(OptSize) && other.calldata == calldata end
call(vm)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4267 def call(vm) canonical.call(vm) end
canonical()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4263 def canonical Send.new(calldata, nil) end
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4243 def deconstruct_keys(_keys) { calldata: calldata } end
disasm(fmt)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4235 def disasm(fmt) fmt.instruction("opt_size", [fmt.calldata(calldata)]) end
length()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4251 def length 2 end
pops()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4255 def pops 1 end
pushes()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4259 def pushes 1 end
to_a(_iseq)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4239 def to_a(_iseq) [:opt_size, calldata.to_h] end