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

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 687
def ==(other)
  other.is_a?(ConcatArray)
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 699
def call(vm)
  left, right = vm.pop(2)
  vm.push([*left, *right])
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 683
def deconstruct_keys(_keys)
  {}
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 675
def disasm(fmt)
  fmt.instruction("concatarray")
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 691
def pops
  2
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 695
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 679
def to_a(_iseq)
  [:concatarray]
end