class SyntaxTree::YARV::Dup

### Summary

‘dup` copies the top value of the stack and pushes it onto the stack.

### Usage

~~~ruby $global = 5 ~~~

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1219
def ==(other)
  other.is_a?(Dup)
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1231
def call(vm)
  vm.push(vm.stack.last.dup)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1215
def deconstruct_keys(_keys)
  {}
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1207
def disasm(fmt)
  fmt.instruction("dup")
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1223
def pops
  1
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1227
def pushes
  2
end
side_effects?() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1235
def side_effects?
  false
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1211
def to_a(_iseq)
  [:dup]
end