Class: SyntaxTree::YARV::OptNot
Overview
### Summary
‘opt_not` negates the value on top of the stack by calling the `!` method on it. It pops the receiver off the stack and pushes on the result.
### Usage
~~~ruby !true ~~~
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #falls_through?, #leaves?, #side_effects?
Constructor Details
#initialize(calldata) ⇒ OptNot
Returns a new instance of OptNot.
3948
3949
3950
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3948
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
3946
3947
3948
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3946
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
3964
3965
3966
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3964
def ==(other)
other.is_a?(OptNot) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
3984
3985
3986
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3984
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
3980
3981
3982
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3980
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
3960
3961
3962
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3960
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
3952
3953
3954
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3952
def disasm(fmt)
fmt.instruction("opt_not", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
3968
3969
3970
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3968
def length
2
end
|
#pops ⇒ Object
3972
3973
3974
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3972
def pops
1
end
|
#pushes ⇒ Object
3976
3977
3978
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3976
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
3956
3957
3958
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 3956
def to_a(_iseq)
[:opt_not, calldata.to_h]
end
|