class SyntaxTree::YARV::Legacy::GetClassVariable

### Summary

‘getclassvariable` looks for a class variable in the current class and pushes its value onto the stack.

This version of the ‘getclassvariable` instruction is no longer used since in Ruby 3.0 it gained an inline cache.`

### Usage

~~~ruby @@class_variable ~~~

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 25
def initialize(name)
  @name = name
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 41
def ==(other)
  other.is_a?(GetClassVariable) && other.name == name
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 57
def call(vm)
  canonical.call(vm)
end
canonical() click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 53
def canonical
  YARV::GetClassVariable.new(name, nil)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 37
def deconstruct_keys(_keys)
  { name: name }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 29
def disasm(fmt)
  fmt.instruction("getclassvariable", [fmt.object(name)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 45
def length
  2
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 49
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 33
def to_a(_iseq)
  [:getclassvariable, name]
end