class SyntaxTree::YARV::SetLocalWC0

### Summary

‘setlocal_WC_0` is a specialized version of the `setlocal` instruction. It sets the value of a local variable on the current frame to the value at the top of the stack as determined by the index given as its only argument.

### Usage

~~~ruby value = 5 ~~~

Attributes

index[R]

Public Class Methods

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

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5241
def ==(other)
  other.is_a?(SetLocalWC0) && other.index == index
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5257
def call(vm)
  canonical.call(vm)
end
canonical() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5253
def canonical
  SetLocal.new(index, 0)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5237
def deconstruct_keys(_keys)
  { index: index }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5229
def disasm(fmt)
  fmt.instruction("setlocal_WC_0", [fmt.local(index, implicit: 0)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5245
def length
  2
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5249
def pops
  1
end
to_a(iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 5233
def to_a(iseq)
  [:setlocal_WC_0, iseq.local_table.offset(index)]
end