class SyntaxTree::YARV::PutSpecialObject

### 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 ~~~

Constants

OBJECT_CBASE
OBJECT_CONST_BASE
OBJECT_VMCORE

Attributes

object[R]

Public Class Methods

new(object) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4720
def initialize(object)
  @object = object
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4736
def ==(other)
  other.is_a?(PutSpecialObject) && other.object == object
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4748
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) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4732
def deconstruct_keys(_keys)
  { object: object }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4724
def disasm(fmt)
  fmt.instruction("putspecialobject", [fmt.object(object)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4740
def length
  2
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4744
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4728
def to_a(_iseq)
  [:putspecialobject, object]
end