Class: SyntaxTree::YARV::OptSucc
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::OptSucc
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
opt_succ is a specialization of the opt_send_without_block instruction when the method being called is succ. Fast paths exist when the receiver is either a String or a Fixnum. It pops the receiver off the stack and pushes on the result.
### Usage
~~~ruby “”.succ ~~~
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) ⇒ OptSucc
constructor
A new instance of OptSucc.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(calldata) ⇒ OptSucc
4085 4086 4087 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4085 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
4083 4084 4085 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4083 def calldata @calldata end |
Instance Method Details
#call(vm) ⇒ Object
4113 4114 4115 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4113 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
4109 4110 4111 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4109 def canonical Send.new(calldata, nil) end |
#disasm(fmt) ⇒ Object
4089 4090 4091 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4089 def disasm(fmt) fmt.instruction("opt_succ", [fmt.calldata(calldata)]) end |
#length ⇒ Object
4097 4098 4099 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4097 def length 2 end |
#pops ⇒ Object
4101 4102 4103 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4101 def pops 1 end |
#pushes ⇒ Object
4105 4106 4107 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4105 def pushes 1 end |
#to_a(_iseq) ⇒ Object
4093 4094 4095 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4093 def to_a(_iseq) [:opt_succ, calldata.to_h] end |