Class: SyntaxTree::YARV::PutSpecialObject
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
alias foo bar
Constant Summary
collapse
- OBJECT_VMCORE =
1
- OBJECT_CBASE =
2
- OBJECT_CONST_BASE =
3
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #canonical, #falls_through?, #leaves?, #pops, #side_effects?
Constructor Details
Returns a new instance of PutSpecialObject.
4766
4767
4768
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4766
def initialize(object)
@object = object
end
|
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
4764
4765
4766
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4764
def object
@object
end
|
Instance Method Details
#==(other) ⇒ Object
4782
4783
4784
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4782
def ==(other)
other.is_a?(PutSpecialObject) && other.object == object
end
|
#call(vm) ⇒ Object
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4794
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
|
#deconstruct_keys(_keys) ⇒ Object
4778
4779
4780
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4778
def deconstruct_keys(_keys)
{ object: object }
end
|
#disasm(fmt) ⇒ Object
4770
4771
4772
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4770
def disasm(fmt)
fmt.instruction("putspecialobject", [fmt.object(object)])
end
|
#length ⇒ Object
4786
4787
4788
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4786
def length
2
end
|
#pushes ⇒ Object
4790
4791
4792
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4790
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
4774
4775
4776
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4774
def to_a(_iseq)
[:putspecialobject, object]
end
|