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



2218
2219
2220
# File 'lib/syntax_tree/yarv/instructions.rb', line 2218

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

#call(vm) ⇒ Object



2232
2233
2234
# File 'lib/syntax_tree/yarv/instructions.rb', line 2232

def call(vm)
  vm.leave
end

#deconstruct_keys(_keys) ⇒ Object



2214
2215
2216
# File 'lib/syntax_tree/yarv/instructions.rb', line 2214

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



2206
2207
2208
# File 'lib/syntax_tree/yarv/instructions.rb', line 2206

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

#leaves?Boolean

Returns:

  • (Boolean)


2236
2237
2238
# File 'lib/syntax_tree/yarv/instructions.rb', line 2236

def leaves?
  true
end

#popsObject



2222
2223
2224
# File 'lib/syntax_tree/yarv/instructions.rb', line 2222

def pops
  1
end

#pushesObject



2226
2227
2228
2229
2230
# File 'lib/syntax_tree/yarv/instructions.rb', line 2226

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



2210
2211
2212
# File 'lib/syntax_tree/yarv/instructions.rb', line 2210

def to_a(_iseq)
  [:leave]
end