diff --git a/ts2panda/src/compiler.ts b/ts2panda/src/compiler.ts index 7affc7fa7980ba9bb94ba6355086f0abf74e40bc..b323fc7b57b1b4b19bf7d1b31ca0b52fa3ff48bd 100644 --- a/ts2panda/src/compiler.ts +++ b/ts2panda/src/compiler.ts @@ -590,8 +590,8 @@ export class Compiler { let labelName: string = jshelpers.getTextOfIdentifierOrLiteral(stmt.label); let blockEndLabel = undefined; - // because there is no label in the block statement, we need to add the end label. - if (stmt.statement.kind == ts.SyntaxKind.Block) { + // because there is no label in the block/if statement, we need to add the end label. + if (stmt.statement.kind == ts.SyntaxKind.Block || stmt.statement.kind == ts.SyntaxKind.IfStatement) { blockEndLabel = new Label(); let labelTarget = new LabelTarget(blockEndLabel, undefined);