From 56b35e06e238ad6b4c546fd6aa406e1e740ccad8 Mon Sep 17 00:00:00 2001 From: Andrew Morris Date: Thu, 23 Mar 2023 10:14:34 +1100 Subject: [PATCH] Add finallyWithoutThrow concept --- concept-code/exceptions/finallyWithoutThrow.ts | 10 ++++++++++ concept-code/exceptions/finallyWithoutThrow.vsm | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 concept-code/exceptions/finallyWithoutThrow.ts create mode 100644 concept-code/exceptions/finallyWithoutThrow.vsm diff --git a/concept-code/exceptions/finallyWithoutThrow.ts b/concept-code/exceptions/finallyWithoutThrow.ts new file mode 100644 index 0000000..53686c1 --- /dev/null +++ b/concept-code/exceptions/finallyWithoutThrow.ts @@ -0,0 +1,10 @@ +export default function () { + let result: string; + + try { + } finally { + result = "Ok"; + } + + return result; +} diff --git a/concept-code/exceptions/finallyWithoutThrow.vsm b/concept-code/exceptions/finallyWithoutThrow.vsm new file mode 100644 index 0000000..aad157a --- /dev/null +++ b/concept-code/exceptions/finallyWithoutThrow.vsm @@ -0,0 +1,10 @@ +export @_anon0 {} + +@_anon0 = function() { + set_catch :finally0 %_tmp0 + unset_catch +finally0: + mov "Ok" %result + throw %_tmp0 + mov %result %return +}