class SyntaxTree::YARV::NewArray

### Summary

‘newarray` puts a new array initialized with `number` values from the stack. It pops `number` values off the stack and pushes the array onto the stack.

### Usage

~~~ruby

“string”

~~~

Attributes

number[R]

Public Class Methods

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

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2330
def ==(other)
  other.is_a?(NewArray) && other.number == number
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2346
def call(vm)
  vm.push(vm.pop(number))
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2326
def deconstruct_keys(_keys)
  { number: number }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2318
def disasm(fmt)
  fmt.instruction("newarray", [fmt.object(number)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2334
def length
  2
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2338
def pops
  number
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2342
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2322
def to_a(_iseq)
  [:newarray, number]
end