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
- #call(vm) ⇒ Object
- #canonical ⇒ 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
4980 4981 4982 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4980 def initialize(number) @number = number end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
4978 4979 4980 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4978 def number @number end |
Instance Method Details
#call(vm) ⇒ Object
5008 5009 5010 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5008 def call(vm) vm.stack[-number - 1] = vm.stack.last end |
#canonical ⇒ Object
5004 5005 5006 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5004 def canonical self end |
#disasm(fmt) ⇒ Object
4984 4985 4986 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4984 def disasm(fmt) fmt.instruction("setn", [fmt.object(number)]) end |
#length ⇒ Object
4992 4993 4994 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4992 def length 2 end |
#pops ⇒ Object
4996 4997 4998 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4996 def pops 1 end |
#pushes ⇒ Object
5000 5001 5002 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5000 def pushes 1 end |
#to_a(_iseq) ⇒ Object
4988 4989 4990 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4988 def to_a(_iseq) [:setn, number] end |