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



2536
2537
2538
# File 'lib/syntax_tree/yarv/instructions.rb', line 2536

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

#call(vm) ⇒ Object



2540
2541
# File 'lib/syntax_tree/yarv/instructions.rb', line 2540

def call(vm)
end

#deconstruct_keys(_keys) ⇒ Object



2532
2533
2534
# File 'lib/syntax_tree/yarv/instructions.rb', line 2532

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



2524
2525
2526
# File 'lib/syntax_tree/yarv/instructions.rb', line 2524

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

#side_effects?Boolean

Returns:

  • (Boolean)


2543
2544
2545
# File 'lib/syntax_tree/yarv/instructions.rb', line 2543

def side_effects?
  false
end

#to_a(_iseq) ⇒ Object



2528
2529
2530
# File 'lib/syntax_tree/yarv/instructions.rb', line 2528

def to_a(_iseq)
  [:nop]
end