class SyntaxTree::YARV::OptNilP
### Summary
‘opt_nil_p` is an optimization applied when the method `nil?` is called. It returns true immediately when the receiver is `nil` and defers to the `nil?` method in other cases. It pops the receiver off the stack and pushes on the result.
### Usage
~~~ruby “”.nil? ~~~
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3946 def initialize(calldata) @calldata = calldata end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3962 def ==(other) other.is_a?(OptNilP) && other.calldata == calldata end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3982 def call(vm) canonical.call(vm) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3978 def canonical Send.new(calldata, nil) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3958 def deconstruct_keys(_keys) { calldata: calldata } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3950 def disasm(fmt) fmt.instruction("opt_nil_p", [fmt.calldata(calldata)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3954 def to_a(_iseq) [:opt_nil_p, calldata.to_h] end