Class: SyntaxTree::YARV::OptAsetWith
Overview
### 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 ~~~
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #canonical, #falls_through?, #leaves?, #side_effects?
Constructor Details
#initialize(object, calldata) ⇒ OptAsetWith
Returns a new instance of OptAsetWith.
2898
2899
2900
2901
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2898
def initialize(object, calldata)
@object = object
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
2896
2897
2898
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2896
def calldata
@calldata
end
|
#object ⇒ Object
Returns the value of attribute object.
2896
2897
2898
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2896
def object
@object
end
|
Instance Method Details
#==(other) ⇒ Object
2918
2919
2920
2921
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2918
def ==(other)
other.is_a?(OptAsetWith) && other.object == object &&
other.calldata == calldata
end
|
#call(vm) ⇒ Object
2935
2936
2937
2938
|
# 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) ⇒ Object
2914
2915
2916
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2914
def deconstruct_keys(_keys)
{ object: object, calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
2903
2904
2905
2906
2907
2908
|
# 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 ⇒ Object
2923
2924
2925
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2923
def length
3
end
|
#pops ⇒ Object
2927
2928
2929
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2927
def pops
2
end
|
#pushes ⇒ Object
2931
2932
2933
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2931
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
2910
2911
2912
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2910
def to_a(_iseq)
[:opt_aset_with, object, calldata.to_h]
end
|