Class: SyntaxTree::YARV::OptAset
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::OptAset
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
opt_aset is an instruction for setting the hash value by the key in the ‘recv = set` format. It is a specialization of the opt_send_without_block instruction. It pops the receiver, the key, and the value off the stack and pushes on the result.
### Usage
Instance Attribute Summary collapse
-
#calldata ⇒ Object
readonly
Returns the value of attribute calldata.
Instance Method Summary collapse
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(calldata) ⇒ OptAset
constructor
A new instance of OptAset.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(calldata) ⇒ OptAset
Returns a new instance of OptAset.
2677 2678 2679 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2677 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
2675 2676 2677 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2675 def calldata @calldata end |
Instance Method Details
#call(vm) ⇒ Object
2705 2706 2707 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2705 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
2701 2702 2703 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2701 def canonical Send.new(calldata, nil) end |
#disasm(fmt) ⇒ Object
2681 2682 2683 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2681 def disasm(fmt) fmt.instruction("opt_aset", [fmt.calldata(calldata)]) end |
#length ⇒ Object
2689 2690 2691 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2689 def length 2 end |
#pops ⇒ Object
2693 2694 2695 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2693 def pops 3 end |
#pushes ⇒ Object
2697 2698 2699 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2697 def pushes 1 end |
#to_a(_iseq) ⇒ Object
2685 2686 2687 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2685 def to_a(_iseq) [:opt_aset, calldata.to_h] end |