Class: SyntaxTree::YARV::Nop

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

Overview

### Summary

nop is a no-operation instruction. It is used to pad the instruction sequence so there is a place for other instructions to jump to.

### Usage

~~~ruby raise rescue true ~~~

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



2708
2709
2710
# File 'lib/syntax_tree/yarv/instructions.rb', line 2708

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

#call(vm) ⇒ Object



2728
2729
# File 'lib/syntax_tree/yarv/instructions.rb', line 2728

def call(vm)
end

#canonicalObject



2724
2725
2726
# File 'lib/syntax_tree/yarv/instructions.rb', line 2724

def canonical
  self
end

#deconstruct_keys(_keys) ⇒ Object



2704
2705
2706
# File 'lib/syntax_tree/yarv/instructions.rb', line 2704

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



2696
2697
2698
# File 'lib/syntax_tree/yarv/instructions.rb', line 2696

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

#lengthObject



2712
2713
2714
# File 'lib/syntax_tree/yarv/instructions.rb', line 2712

def length
  1
end

#popsObject



2716
2717
2718
# File 'lib/syntax_tree/yarv/instructions.rb', line 2716

def pops
  0
end

#pushesObject



2720
2721
2722
# File 'lib/syntax_tree/yarv/instructions.rb', line 2720

def pushes
  0
end

#to_a(_iseq) ⇒ Object



2700
2701
2702
# File 'lib/syntax_tree/yarv/instructions.rb', line 2700

def to_a(_iseq)
  [:nop]
end