Class: SyntaxTree::YARV::PutSpecialObject
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::PutSpecialObject
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
putspecialobject pushes one of three special objects onto the stack. These are either the VM core special object, the class base special object, or the constant base special object.
### Usage
~~~ruby alias foo bar ~~~
Constant Summary collapse
- OBJECT_VMCORE =
1- OBJECT_CBASE =
2- OBJECT_CONST_BASE =
3
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) ⇒ PutSpecialObject
constructor
A new instance of PutSpecialObject.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(object) ⇒ PutSpecialObject
Returns a new instance of PutSpecialObject.
4387 4388 4389 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4387 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
4385 4386 4387 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4385 def object @object end |
Instance Method Details
#call(vm) ⇒ Object
4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4415 def call(vm) case object when OBJECT_VMCORE vm.push(vm.frozen_core) when OBJECT_CBASE value = vm.frame._self value = value.singleton_class unless value.is_a?(Class) vm.push(value) when OBJECT_CONST_BASE vm.push(vm.const_base) end end |
#canonical ⇒ Object
4411 4412 4413 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4411 def canonical self end |
#disasm(fmt) ⇒ Object
4391 4392 4393 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4391 def disasm(fmt) fmt.instruction("putspecialobject", [fmt.object(object)]) end |
#length ⇒ Object
4399 4400 4401 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4399 def length 2 end |
#pops ⇒ Object
4403 4404 4405 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4403 def pops 0 end |
#pushes ⇒ Object
4407 4408 4409 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4407 def pushes 1 end |
#to_a(_iseq) ⇒ Object
4395 4396 4397 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4395 def to_a(_iseq) [:putspecialobject, object] end |