Class: SyntaxTree::YARV::DupArray
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::DupArray
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
duparray dups an Array literal and pushes it onto the stack.
### Usage
~~~ruby
- true
-
~~~
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(object) ⇒ DupArray
constructor
A new instance of DupArray.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(object) ⇒ DupArray
1155 1156 1157 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1155 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
1153 1154 1155 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1153 def object @object end |
Instance Method Details
#call(vm) ⇒ Object
1183 1184 1185 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1183 def call(vm) vm.push(object.dup) end |
#canonical ⇒ Object
1179 1180 1181 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1179 def canonical self end |
#disasm(fmt) ⇒ Object
1159 1160 1161 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1159 def disasm(fmt) fmt.instruction("duparray", [fmt.object(object)]) end |
#length ⇒ Object
1167 1168 1169 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1167 def length 2 end |
#pops ⇒ Object
1171 1172 1173 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1171 def pops 0 end |
#pushes ⇒ Object
1175 1176 1177 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1175 def pushes 1 end |
#to_a(_iseq) ⇒ Object
1163 1164 1165 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1163 def to_a(_iseq) [:duparray, object] end |