class SyntaxTree::YARV::GetGlobal
### Summary
‘getglobal` pushes the value of a global variables onto the stack.
### Usage
~~~ruby $$ ~~~
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 1773 def initialize(name) @name = name end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 1789 def ==(other) other.is_a?(GetGlobal) && other.name == name end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 1801 def call(vm) # Evaluating the name of the global variable because there isn't a # reflection API for global variables. vm.push(eval(name.to_s, binding, __FILE__, __LINE__)) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 1785 def deconstruct_keys(_keys) { name: name } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 1777 def disasm(fmt) fmt.instruction("getglobal", [fmt.object(name)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 1781 def to_a(_iseq) [:getglobal, name] end