class SyntaxTree::YARV::GetClassVariable
~~~
@@class_variable
~~~ruby
### Usage
need to lookup the class variable in the class hierarchy every time.
pushes its value onto the stack. It uses an inline cache to reduce the
`getclassvariable` looks for a class variable in the current class and
### Summary
def ==(other)
def ==(other) other.is_a?(GetClassVariable) && other.name == name && other.cache == cache end
def call(vm)
def call(vm) clazz = vm.frame._self clazz = clazz.class unless clazz.is_a?(Class) vm.push(clazz.class_variable_get(name)) end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { name: name, cache: cache } end
def disasm(fmt)
def disasm(fmt) fmt.instruction( "getclassvariable", [fmt.object(name), fmt.inline_storage(cache)] ) end
def initialize(name, cache)
def initialize(name, cache) @name = name @cache = cache end
def length
def length 3 end
def pushes
def pushes 1 end
def to_a(_iseq)
def to_a(_iseq) [:getclassvariable, name, cache] end