Class: SyntaxTree::YARV::Leave

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

Overview

### Summary

leave exits the current frame.

### Usage

~~~ruby ;; ~~~

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



2428
2429
2430
# File 'lib/syntax_tree/yarv/instructions.rb', line 2428

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

#call(vm) ⇒ Object



2450
2451
2452
# File 'lib/syntax_tree/yarv/instructions.rb', line 2450

def call(vm)
  vm.leave
end

#canonicalObject



2446
2447
2448
# File 'lib/syntax_tree/yarv/instructions.rb', line 2446

def canonical
  self
end

#deconstruct_keys(_keys) ⇒ Object



2424
2425
2426
# File 'lib/syntax_tree/yarv/instructions.rb', line 2424

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



2416
2417
2418
# File 'lib/syntax_tree/yarv/instructions.rb', line 2416

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

#lengthObject



2432
2433
2434
# File 'lib/syntax_tree/yarv/instructions.rb', line 2432

def length
  1
end

#popsObject



2436
2437
2438
# File 'lib/syntax_tree/yarv/instructions.rb', line 2436

def pops
  1
end

#pushesObject



2440
2441
2442
2443
2444
# File 'lib/syntax_tree/yarv/instructions.rb', line 2440

def pushes
  # TODO: This is wrong. It should be 1. But it's 0 for now because
  # otherwise the stack size is incorrectly calculated.
  0
end

#to_a(_iseq) ⇒ Object



2420
2421
2422
# File 'lib/syntax_tree/yarv/instructions.rb', line 2420

def to_a(_iseq)
  [:leave]
end