diff --git a/ts2panda/src/statement/tryStatement.ts b/ts2panda/src/statement/tryStatement.ts index d720e5420da8226cb338697f6cb146f30bf40d77..c5a81771153bf2d04dff0fc42938b36de63bce83 100644 --- a/ts2panda/src/statement/tryStatement.ts +++ b/ts2panda/src/statement/tryStatement.ts @@ -206,8 +206,10 @@ export class TryBuilder extends TryBuilderBase { this.compiler.pushScope(catchClause); compileCatchClauseVariableDeclaration(this.compiler, catchClause.variableDeclaration); let catchBlock = catchClause.block; + this.compiler.pushScope(catchBlock); catchBlock.statements.forEach((stmt) => this.compiler.compileStatement(stmt)); this.compiler.popScope(); + this.compiler.popScope(); } else { // finallyBlock rethrow exception when it catch the exception let exceptionVreg = this.pandaGen.getTemp();