patch 8.2.2539: Vim9: return from finally block causes a hang
Problem: Vim9: return from finally block causes a hang.
Solution: Store both the finally and endtry indexes. (closes #7885)
diff --git a/src/vim9.h b/src/vim9.h
index ca8e64d..66a21b7 100644
--- a/src/vim9.h
+++ b/src/vim9.h
@@ -100,6 +100,7 @@
ISN_THROW, // pop value of stack, store in v:exception
ISN_PUSHEXC, // push v:exception
ISN_CATCH, // drop v:exception
+ ISN_FINALLY, // start of :finally block
ISN_ENDTRY, // take entry off from ec_trystack
ISN_TRYCONT, // handle :continue inside a :try statement
@@ -208,10 +209,16 @@
int for_end; // position to jump to after done
} forloop_T;
-// arguments to ISN_TRY
+// indirect arguments to ISN_TRY
typedef struct {
int try_catch; // position to jump to on throw
int try_finally; // :finally or :endtry position to jump to
+ int try_endtry; // :endtry position to jump to
+} tryref_T;
+
+// arguments to ISN_TRY
+typedef struct {
+ tryref_T *try_ref;
} try_T;
// arguments to ISN_TRYCONT