@@ -265,12 +265,35 @@ export class Flow {
265265 trueFlows : Map < ExpressionRef , Flow > | null = null ;
266266 /** Alternative flows if a compound expression is false-ish. */
267267 falseFlows : Map < ExpressionRef , Flow > | null = null ;
268+ /** Try-finally context: local index for pending action (0=none, 1=return, 2=break, 3=continue). */
269+ tryFinallyPendingActionLocal : i32 = - 1 ;
270+ /** Try-finally context: local index for pending return value. */
271+ tryFinallyPendingValueLocal : i32 = - 1 ;
272+ /** Try-finally context: label to branch to for finally dispatch. */
273+ tryFinallyDispatchLabel : string | null = null ;
274+ /** Try-finally context: return type for the pending value. */
275+ tryFinallyReturnType : Type | null = null ;
268276
269277 /** Tests if this is an inline flow. */
270278 get isInline ( ) : bool {
271279 return this . inlineFunction != null ;
272280 }
273281
282+ /** Tests if this flow or any parent is in a try-finally context. */
283+ get isInTryFinally ( ) : bool {
284+ return this . tryFinallyPendingActionLocal >= 0 ;
285+ }
286+
287+ /** Gets the try-finally context from this flow or a parent flow. */
288+ getTryFinallyContext ( ) : Flow | null {
289+ let flow : Flow | null = this ;
290+ while ( flow ) {
291+ if ( flow . tryFinallyPendingActionLocal >= 0 ) return flow ;
292+ flow = flow . parent ;
293+ }
294+ return null ;
295+ }
296+
274297 /** Gets the source function being compiled. Differs from target when inlining. */
275298 get sourceFunction ( ) : Function {
276299 // Obtaining the source function is useful when resolving elements relative
0 commit comments