class SyntaxTree::YARV::GetLocalWC1

### Summary

‘getlocal_WC_1` is a specialized version of the `getlocal` instruction. It fetches the value of a local variable from the parent frame determined by the index given as its only argument.

### Usage

~~~ruby value = 5 self.then { value } ~~~

Attributes

index[R]

Public Class Methods

new(index) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1936
def initialize(index)
  @index = index
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1952
def ==(other)
  other.is_a?(GetLocalWC1) && other.index == index
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1968
def call(vm)
  canonical.call(vm)
end
canonical() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1964
def canonical
  GetLocal.new(index, 1)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1948
def deconstruct_keys(_keys)
  { index: index }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1940
def disasm(fmt)
  fmt.instruction("getlocal_WC_1", [fmt.local(index, implicit: 1)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1956
def length
  2
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1960
def pushes
  1
end
to_a(iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1944
def to_a(iseq)
  [:getlocal_WC_1, iseq.parent_iseq.local_table.offset(index)]
end