Implement execution of finally block. Fixes #1306.

This commit is contained in:
Windel Bouwman committed 2019-08-27 21:16:59 +02:00
1 parent 86fc18ec6c
commit 2ca6e5d399
4 files changed
+94 -40

No files matched your search

+5
View File
@@ -187,11 +187,15 @@ pub enum Instruction {
handler: Label,
},
/// Enter a finally block, without returning, excepting, just because we are there.
EnterFinally,
/// Marker bytecode for the end of a finally sequence.
/// When this bytecode is executed, the eval loop does one of those things:
/// - Continue at a certain bytecode position
/// - Propagate the exception
/// - Return from a function
/// - Do nothing at all, just continue
EndFinally,
SetupExcept {
@@ -493,6 +497,7 @@ impl Instruction {
SetupLoop { start, end } => w!(SetupLoop, label_map[start], label_map[end]),
SetupExcept { handler } => w!(SetupExcept, label_map[handler]),
SetupFinally { handler } => w!(SetupFinally, label_map[handler]),
EnterFinally => w!(EnterFinally),
EndFinally => w!(EndFinally),
SetupWith { end } => w!(SetupWith, end),
CleanupWith { end } => w!(CleanupWith, end),