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



2276
2277
2278
# File 'lib/syntax_tree/yarv/instructions.rb', line 2276

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

#call(vm) ⇒ Object



2290
2291
2292
# File 'lib/syntax_tree/yarv/instructions.rb', line 2290

def call(vm)
  vm.leave
end

#deconstruct_keys(_keys) ⇒ Object



2272
2273
2274
# File 'lib/syntax_tree/yarv/instructions.rb', line 2272

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



2264
2265
2266
# File 'lib/syntax_tree/yarv/instructions.rb', line 2264

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

#leaves?Boolean

Returns:

  • (Boolean)


2294
2295
2296
# File 'lib/syntax_tree/yarv/instructions.rb', line 2294

def leaves?
  true
end

#popsObject



2280
2281
2282
# File 'lib/syntax_tree/yarv/instructions.rb', line 2280

def pops
  1
end

#pushesObject



2284
2285
2286
2287
2288
# File 'lib/syntax_tree/yarv/instructions.rb', line 2284

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



2268
2269
2270
# File 'lib/syntax_tree/yarv/instructions.rb', line 2268

def to_a(_iseq)
  [:leave]
end