class SyntaxTree::YARV::GetLocalWC0

### Summary

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

### Usage

~~~ruby value = 5 value ~~~

Attributes

index[R]

Public Class Methods

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

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1899
def ==(other)
  other.is_a?(GetLocalWC0) && other.index == index
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1915
def call(vm)
  canonical.call(vm)
end
canonical() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1911
def canonical
  GetLocal.new(index, 0)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1895
def deconstruct_keys(_keys)
  { index: index }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1887
def disasm(fmt)
  fmt.instruction("getlocal_WC_0", [fmt.local(index, implicit: 0)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1903
def length
  2
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1907
def pushes
  1
end
to_a(iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1891
def to_a(iseq)
  [:getlocal_WC_0, iseq.local_table.offset(index)]
end