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
names[R]
Public Class Methods
new(names)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3260 def initialize(names) @names = names end
Public Instance Methods
==(other)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3277 def ==(other) other.is_a?(OptGetConstantPath) && other.names == names end
call(vm)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3289 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
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3273 def deconstruct_keys(_keys) { names: names } end
disasm(fmt)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3264 def disasm(fmt) cache = "<ic:0 #{names.join("::")}>" fmt.instruction("opt_getconstant_path", [cache]) end
length()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3281 def length 2 end
pushes()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3285 def pushes 1 end
to_a(_iseq)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3269 def to_a(_iseq) [:opt_getconstant_path, names] end