diff --git a/ts2panda/src/statement/tryStatement.ts b/ts2panda/src/statement/tryStatement.ts index 23399828d653878c2aee6f4246ff11d0bdc74165..2ae2fa97d592c49d4b0f9ab99a1f3f152e177bd3 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();