Class: SyntaxTree::YARV::SetN
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::SetN
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(number) ⇒ SetN
constructor
A new instance of SetN.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(number) ⇒ SetN
Returns a new instance of SetN.
5723 5724 5725 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5723 def initialize(number) @number = number end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
5721 5722 5723 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5721 def number @number end |
Instance Method Details
#==(other) ⇒ Object
5739 5740 5741 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5739 def ==(other) other.is_a?(SetN) && other.number == number end |
#call(vm) ⇒ Object
5759 5760 5761 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5759 def call(vm) vm.stack[-number - 1] = vm.stack.last end |
#canonical ⇒ Object
5755 5756 5757 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5755 def canonical self end |
#deconstruct_keys(_keys) ⇒ Object
5735 5736 5737 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5735 def deconstruct_keys(_keys) { number: number } end |
#disasm(fmt) ⇒ Object
5727 5728 5729 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5727 def disasm(fmt) fmt.instruction("setn", [fmt.object(number)]) end |
#length ⇒ Object
5743 5744 5745 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5743 def length 2 end |
#pops ⇒ Object
5747 5748 5749 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5747 def pops 1 end |
#pushes ⇒ Object
5751 5752 5753 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5751 def pushes 1 end |
#to_a(_iseq) ⇒ Object
5731 5732 5733 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5731 def to_a(_iseq) [:setn, number] end |