From 7ce3e4b2bb342b14e30fe195ae53ea9e2ca1b195 Mon Sep 17 00:00:00 2001 From: Andrew Morris Date: Fri, 21 Jul 2023 16:52:40 +1000 Subject: [PATCH] Fix reverting `this` in try-catch --- inputs/{failing => passing}/exceptions/snapshotThis.ts | 3 +-- valuescript_compiler/src/function_compiler.rs | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) rename inputs/{failing => passing}/exceptions/snapshotThis.ts (84%) diff --git a/inputs/failing/exceptions/snapshotThis.ts b/inputs/passing/exceptions/snapshotThis.ts similarity index 84% rename from inputs/failing/exceptions/snapshotThis.ts rename to inputs/passing/exceptions/snapshotThis.ts index ef248584..ff2c2b1f 100644 --- a/inputs/failing/exceptions/snapshotThis.ts +++ b/inputs/passing/exceptions/snapshotThis.ts @@ -1,5 +1,4 @@ -//! test_output(1) -// (Should be 0.) +//! test_output(0) export default function main() { let foo = new Foo(); diff --git a/valuescript_compiler/src/function_compiler.rs b/valuescript_compiler/src/function_compiler.rs index ea172695..84e42b17 100644 --- a/valuescript_compiler/src/function_compiler.rs +++ b/valuescript_compiler/src/function_compiler.rs @@ -849,10 +849,6 @@ impl FunctionCompiler { let snap_registers = self.get_mutated_registers(try_.block.span); for reg in snap_registers { - if !reg.is_named() { - continue; - } - let snap_reg = self.allocate_reg_fresh(&format!("snap_{}", reg.name)); self.push(Instruction::Mov(