Class: SyntaxTree::YARV::OptNot
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::OptNot
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
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
-
#calldata ⇒ Object
readonly
Returns the value of attribute calldata.
Instance Method Summary collapse
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(calldata) ⇒ OptNot
constructor
A new instance of OptNot.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(calldata) ⇒ OptNot
Returns a new instance of OptNot.
3689 3690 3691 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3689 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
3687 3688 3689 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3687 def calldata @calldata end |
Instance Method Details
#call(vm) ⇒ Object
3717 3718 3719 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3717 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
3713 3714 3715 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3713 def canonical Send.new(calldata, nil) end |
#disasm(fmt) ⇒ Object
3693 3694 3695 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3693 def disasm(fmt) fmt.instruction("opt_not", [fmt.calldata(calldata)]) end |
#length ⇒ Object
3701 3702 3703 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3701 def length 2 end |
#pops ⇒ Object
3705 3706 3707 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3705 def pops 1 end |
#pushes ⇒ Object
3709 3710 3711 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3709 def pushes 1 end |
#to_a(_iseq) ⇒ Object
3697 3698 3699 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3697 def to_a(_iseq) [:opt_not, calldata.to_h] end |