class SyntaxTree::YARV::OptGetConstantPath
### Summary
‘opt_getconstant_path` performs a constant lookup on a chain of constant names. It accepts as its argument an array of constant names, and pushes the value of the constant onto the stack.
### Usage
~~~ruby ::Object ~~~
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3313 def initialize(names) @names = names end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3330 def ==(other) other.is_a?(OptGetConstantPath) && other.names == names end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3342 def call(vm) current = vm.frame._self current = current.class unless current.is_a?(Class) names.each do |name| current = name == :"" ? Object : current.const_get(name) end vm.push(current) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3326 def deconstruct_keys(_keys) { names: names } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3317 def disasm(fmt) cache = "<ic:0 #{names.join("::")}>" fmt.instruction("opt_getconstant_path", [cache]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3322 def to_a(_iseq) [:opt_getconstant_path, names] end