From a251109090a2a9fa8650fe1983b4289b975a6050 Mon Sep 17 00:00:00 2001 From: Noah <33094578+coolreader18@users.noreply.github.com> Date: Wed, 12 Aug 2020 16:03:20 -0500 Subject: [PATCH] Fix some minor things required for unittest --- src/compile.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compile.rs b/src/compile.rs index 26eca75..a3b7584 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -479,7 +479,9 @@ impl Compiler { self.compile_statements(body)?; - for end_label in end_labels { + // sort of "stack up" the layers of with blocks: + // with a, b: body -> start_with(a) start_with(b) body() end_with(b) end_with(a) + for end_label in end_labels.into_iter().rev() { self.emit(Instruction::PopBlock); self.emit(Instruction::EnterFinally); self.set_label(end_label);