class SyntaxTree::YARV::SetBlockParam
### Summary
‘setblockparam` sets the value of a block local variable on a frame determined by the level and index arguments. The level is the number of frames back to look and the index is the index in the local table. It pops the value it is setting off the stack.
### Usage
~~~ruby def foo(&bar)
bar = baz
end ~~~
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5055 def initialize(index, level) @index = index @level = level end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5074 def ==(other) other.is_a?(SetBlockParam) && other.index == index && other.level == level end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5087 def call(vm) vm.local_set(index, level, vm.pop) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5070 def deconstruct_keys(_keys) { index: index, level: level } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5060 def disasm(fmt) fmt.instruction("setblockparam", [fmt.local(index, explicit: level)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5064 def to_a(iseq) current = iseq level.times { current = current.parent_iseq } [:setblockparam, current.local_table.offset(index), level] end