class SyntaxTree::YARV::ConcatArray
### Summary
‘concatarray` concatenates the two Arrays on top of the stack.
It coerces the two objects at the top of the stack into Arrays by calling ‘to_a` if necessary, and makes sure to `dup` the first Array if it was already an Array, to avoid mutating it when concatenating.
### Usage
~~~ruby
- 1, *2
-
~~~
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 687 def ==(other) other.is_a?(ConcatArray) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 699 def call(vm) left, right = vm.pop(2) vm.push([*left, *right]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 683 def deconstruct_keys(_keys) {} end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 675 def disasm(fmt) fmt.instruction("concatarray") end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 679 def to_a(_iseq) [:concatarray] end