Class: SyntaxTree::YARV::Nop

Inherits:
Instruction 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

Methods inherited from Instruction

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

Instance Method Details

#==(other) ⇒ Object



2589
2590
2591
# File 'lib/syntax_tree/yarv/instructions.rb', line 2589

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

#call(vm) ⇒ Object



2593
2594
# File 'lib/syntax_tree/yarv/instructions.rb', line 2593

def call(vm)
end

#deconstruct_keys(_keys) ⇒ Object



2585
2586
2587
# File 'lib/syntax_tree/yarv/instructions.rb', line 2585

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



2577
2578
2579
# File 'lib/syntax_tree/yarv/instructions.rb', line 2577

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

#side_effects?Boolean

Returns:

  • (Boolean)


2596
2597
2598
# File 'lib/syntax_tree/yarv/instructions.rb', line 2596

def side_effects?
  false
end

#to_a(_iseq) ⇒ Object



2581
2582
2583
# File 'lib/syntax_tree/yarv/instructions.rb', line 2581

def to_a(_iseq)
  [:nop]
end