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
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #deconstruct_keys(_keys) ⇒ 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
4218 4219 4220 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4218 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
4216 4217 4218 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4216 def calldata @calldata end |
Instance Method Details
#==(other) ⇒ Object
4234 4235 4236 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4234 def ==(other) other.is_a?(OptNot) && other.calldata == calldata end |
#call(vm) ⇒ Object
4254 4255 4256 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4254 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
4250 4251 4252 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4250 def canonical Send.new(calldata, nil) end |
#deconstruct_keys(_keys) ⇒ Object
4230 4231 4232 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4230 def deconstruct_keys(_keys) { calldata: calldata } end |
#disasm(fmt) ⇒ Object
4222 4223 4224 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4222 def disasm(fmt) fmt.instruction("opt_not", [fmt.calldata(calldata)]) end |
#length ⇒ Object
4238 4239 4240 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4238 def length 2 end |
#pops ⇒ Object
4242 4243 4244 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4242 def pops 1 end |
#pushes ⇒ Object
4246 4247 4248 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4246 def pushes 1 end |
#to_a(_iseq) ⇒ Object
4226 4227 4228 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4226 def to_a(_iseq) [:opt_not, calldata.to_h] end |