Class: SyntaxTree::YARV::OptStrUMinus
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::OptStrUMinus
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
opt_str_uminus pushes a frozen known string value with no interpolation onto the stack. If the method gets overridden, this will fall back to a send.
### Usage
~~~ruby -“string” ~~~
Instance Attribute Summary collapse
-
#calldata ⇒ Object
readonly
Returns the value of attribute calldata.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(object, calldata) ⇒ OptStrUMinus
constructor
A new instance of OptStrUMinus.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(object, calldata) ⇒ OptStrUMinus
Returns a new instance of OptStrUMinus.
4032 4033 4034 4035 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4032 def initialize(object, calldata) @object = object @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
4030 4031 4032 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4030 def calldata @calldata end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
4030 4031 4032 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4030 def object @object end |
Instance Method Details
#call(vm) ⇒ Object
4064 4065 4066 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4064 def call(vm) vm.push(-object) end |
#canonical ⇒ Object
4060 4061 4062 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4060 def canonical self end |
#disasm(fmt) ⇒ Object
4037 4038 4039 4040 4041 4042 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4037 def disasm(fmt) fmt.instruction( "opt_str_uminus", [fmt.object(object), fmt.calldata(calldata)] ) end |
#length ⇒ Object
4048 4049 4050 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4048 def length 3 end |
#pops ⇒ Object
4052 4053 4054 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4052 def pops 0 end |
#pushes ⇒ Object
4056 4057 4058 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4056 def pushes 1 end |
#to_a(_iseq) ⇒ Object
4044 4045 4046 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4044 def to_a(_iseq) [:opt_str_uminus, object, calldata.to_h] end |