class SyntaxTree::YARV::SetLocalWC1
### Summary
‘setlocal_WC_1` is a specialized version of the `setlocal` instruction. It sets the value of a local variable on the parent frame to the value at the top of the stack as determined by the index given as its only argument.
### Usage
~~~ruby value = 5 self.then { value = 10 } ~~~
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5425 def initialize(index) @index = index end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5441 def ==(other) other.is_a?(SetLocalWC1) && other.index == index end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5457 def call(vm) canonical.call(vm) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5453 def canonical SetLocal.new(index, 1) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5437 def deconstruct_keys(_keys) { index: index } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5429 def disasm(fmt) fmt.instruction("setlocal_WC_1", [fmt.local(index, implicit: 1)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5433 def to_a(iseq) [:setlocal_WC_1, iseq.parent_iseq.local_table.offset(index)] end