Class: SyntaxTree::YARV::PutObject
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::PutObject
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
putobject pushes a known value onto the stack.
### Usage
~~~ruby 5 ~~~
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(object) ⇒ PutObject
constructor
A new instance of PutObject.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(object) ⇒ PutObject
Returns a new instance of PutObject.
4211 4212 4213 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4211 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
4209 4210 4211 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4209 def object @object end |
Instance Method Details
#call(vm) ⇒ Object
4239 4240 4241 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4239 def call(vm) vm.push(object) end |
#canonical ⇒ Object
4235 4236 4237 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4235 def canonical self end |
#disasm(fmt) ⇒ Object
4215 4216 4217 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4215 def disasm(fmt) fmt.instruction("putobject", [fmt.object(object)]) end |
#length ⇒ Object
4223 4224 4225 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4223 def length 2 end |
#pops ⇒ Object
4227 4228 4229 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4227 def pops 0 end |
#pushes ⇒ Object
4231 4232 4233 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4231 def pushes 1 end |
#to_a(_iseq) ⇒ Object
4219 4220 4221 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4219 def to_a(_iseq) [:putobject, object] end |