class SyntaxTree::YARV::ConcatStrings

### Summary

‘concatstrings` pops a number of strings from the stack joins them together into a single string and pushes that string back on the stack.

This does no coercion and so is always used in conjunction with ‘objtostring` and `anytostring` to ensure the stack contents are always strings.

### Usage

~~~ruby “#{5}” ~~~

Attributes

number[R]

Public Class Methods

new(number) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 723
def initialize(number)
  @number = number
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 739
def ==(other)
  other.is_a?(ConcatStrings) && other.number == number
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 755
def call(vm)
  vm.push(vm.pop(number).join)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 735
def deconstruct_keys(_keys)
  { number: number }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 727
def disasm(fmt)
  fmt.instruction("concatstrings", [fmt.object(number)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 743
def length
  2
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 747
def pops
  number
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 751
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 731
def to_a(_iseq)
  [:concatstrings, number]
end