Class: SyntaxTree::YARV::Pop

Inherits:
Instruction show all
Defined in:
lib/syntax_tree/yarv/instructions.rb

Overview

### Summary

‘pop` pops the top value off the stack.

### Usage

~~~ruby a ||= 2 ~~~

Instance Method Summary collapse

Methods inherited from Instruction

#branch_targets, #canonical, #falls_through?, #leaves?, #length, #pushes

Instance Method Details

#==(other) ⇒ Object



4511
4512
4513
# File 'lib/syntax_tree/yarv/instructions.rb', line 4511

def ==(other)
  other.is_a?(Pop)
end

#call(vm) ⇒ Object



4519
4520
4521
# File 'lib/syntax_tree/yarv/instructions.rb', line 4519

def call(vm)
  vm.pop
end

#deconstruct_keys(_keys) ⇒ Object



4507
4508
4509
# File 'lib/syntax_tree/yarv/instructions.rb', line 4507

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



4499
4500
4501
# File 'lib/syntax_tree/yarv/instructions.rb', line 4499

def disasm(fmt)
  fmt.instruction("pop")
end

#popsObject



4515
4516
4517
# File 'lib/syntax_tree/yarv/instructions.rb', line 4515

def pops
  1
end

#side_effects?Boolean

Returns:

  • (Boolean)


4523
4524
4525
# File 'lib/syntax_tree/yarv/instructions.rb', line 4523

def side_effects?
  false
end

#to_a(_iseq) ⇒ Object



4503
4504
4505
# File 'lib/syntax_tree/yarv/instructions.rb', line 4503

def to_a(_iseq)
  [:pop]
end