From 48b8371247b782bc42a51c62cbf5dd5e65774789 Mon Sep 17 00:00:00 2001 From: hufeng Date: Sat, 12 Mar 2022 17:32:20 +0800 Subject: [PATCH] fix Bug of Scope when inserting FinallyBlocks Signed-off-by: hufeng Change-Id: I9df65de7affdad92961ca54c01e9fbae5a4a7aff --- ts2panda/src/compiler.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ts2panda/src/compiler.ts b/ts2panda/src/compiler.ts index c0aed04f32..f18efd3916 100644 --- a/ts2panda/src/compiler.ts +++ b/ts2panda/src/compiler.ts @@ -627,6 +627,7 @@ export class Compiler { compileFinallyBeforeCFC(endTry: TryStatement | undefined, cfc: ControlFlowChange, continueTargetLabel: Label | undefined) {// compile finally before control flow change let startTry = TryStatement.getCurrentTryStatement(); let originTry = startTry; + let currentScope = this.scope; for (; startTry != endTry; startTry = startTry?.getOuterTryStatement()) { if (startTry && startTry.trybuilder) { @@ -646,6 +647,7 @@ export class Compiler { updateCatchTables(originTry, startTry, inlinedLabelPair); } } + this.scope = currentScope; } constructTry(node: ts.Node, tryBuilder: TryBuilderBase, endLabel?: Label) { -- Gitee