Class: SyntaxTree::YARV::Leave

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

Overview

### Summary

‘leave` exits the current frame.

### Usage

~~~ruby ;; ~~~

Instance Method Summary collapse

Methods inherited from Instruction

#branch_targets, #canonical, #falls_through?, #length, #side_effects?

Instance Method Details

#==(other) ⇒ Object



2329
2330
2331
# File 'lib/syntax_tree/yarv/instructions.rb', line 2329

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

#call(vm) ⇒ Object



2343
2344
2345
# File 'lib/syntax_tree/yarv/instructions.rb', line 2343

def call(vm)
  vm.leave
end

#deconstruct_keys(_keys) ⇒ Object



2325
2326
2327
# File 'lib/syntax_tree/yarv/instructions.rb', line 2325

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



2317
2318
2319
# File 'lib/syntax_tree/yarv/instructions.rb', line 2317

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

#leaves?Boolean

Returns:

  • (Boolean)


2347
2348
2349
# File 'lib/syntax_tree/yarv/instructions.rb', line 2347

def leaves?
  true
end

#popsObject



2333
2334
2335
# File 'lib/syntax_tree/yarv/instructions.rb', line 2333

def pops
  1
end

#pushesObject



2337
2338
2339
2340
2341
# File 'lib/syntax_tree/yarv/instructions.rb', line 2337

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



2321
2322
2323
# File 'lib/syntax_tree/yarv/instructions.rb', line 2321

def to_a(_iseq)
  [:leave]
end