class SyntaxTree::YARV::OptAsetWith

### Summary

‘opt_aset_with` is an instruction for setting the hash value by the known string key in the `recv = set` format. It pops the receiver and the value off the stack and pushes on the result.

### Usage

~~~ruby = value ~~~

Attributes

calldata[R]
object[R]

Public Class Methods

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

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2918
def ==(other)
  other.is_a?(OptAsetWith) && other.object == object &&
    other.calldata == calldata
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2935
def call(vm)
  hash, value = vm.pop(2)
  vm.push(hash[object] = value)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2914
def deconstruct_keys(_keys)
  { object: object, calldata: calldata }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2903
def disasm(fmt)
  fmt.instruction(
    "opt_aset_with",
    [fmt.object(object), fmt.calldata(calldata)]
  )
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2923
def length
  3
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2927
def pops
  2
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2931
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2910
def to_a(_iseq)
  [:opt_aset_with, object, calldata.to_h]
end