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
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #deconstruct_keys(_keys) ⇒ 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
Returns a new instance of DupArray.
1281 1282 1283 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1281 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
1279 1280 1281 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1279 def object @object end |
Instance Method Details
#==(other) ⇒ Object
1297 1298 1299 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1297 def ==(other) other.is_a?(DupArray) && other.object == object end |
#call(vm) ⇒ Object
1317 1318 1319 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1317 def call(vm) vm.push(object.dup) end |
#canonical ⇒ Object
1313 1314 1315 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1313 def canonical self end |
#deconstruct_keys(_keys) ⇒ Object
1293 1294 1295 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1293 def deconstruct_keys(_keys) { object: object } end |
#disasm(fmt) ⇒ Object
1285 1286 1287 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1285 def disasm(fmt) fmt.instruction("duparray", [fmt.object(object)]) end |
#length ⇒ Object
1301 1302 1303 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1301 def length 2 end |
#pops ⇒ Object
1305 1306 1307 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1305 def pops 0 end |
#pushes ⇒ Object
1309 1310 1311 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1309 def pushes 1 end |
#to_a(_iseq) ⇒ Object
1289 1290 1291 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1289 def to_a(_iseq) [:duparray, object] end |