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
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #deconstruct_keys(_keys) ⇒ 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.
4830 4831 4832 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4830 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
4828 4829 4830 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4828 def object @object end |
Instance Method Details
#==(other) ⇒ Object
4846 4847 4848 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4846 def ==(other) other.is_a?(PutObject) && other.object == object end |
#call(vm) ⇒ Object
4866 4867 4868 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4866 def call(vm) vm.push(object) end |
#canonical ⇒ Object
4862 4863 4864 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4862 def canonical self end |
#deconstruct_keys(_keys) ⇒ Object
4842 4843 4844 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4842 def deconstruct_keys(_keys) { object: object } end |
#disasm(fmt) ⇒ Object
4834 4835 4836 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4834 def disasm(fmt) fmt.instruction("putobject", [fmt.object(object)]) end |
#length ⇒ Object
4850 4851 4852 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4850 def length 2 end |
#pops ⇒ Object
4854 4855 4856 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4854 def pops 0 end |
#pushes ⇒ Object
4858 4859 4860 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4858 def pushes 1 end |
#to_a(_iseq) ⇒ Object
4838 4839 4840 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4838 def to_a(_iseq) [:putobject, object] end |