Skip to content

Commit 424a0dd

Browse files
Copilotjakebailey
andcommitted
Clear Unreachable flag for labels in incremental scenarios
Co-authored-by: jakebailey <[email protected]>
1 parent 940d8c2 commit 424a0dd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/compiler/binder.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,8 +1791,14 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
17911791
bind(node.label);
17921792
bind(node.statement);
17931793
if (!activeLabelList.referenced) {
1794+
// Clear Unreachable flag from previous binding (for incremental scenarios)
1795+
(node.label as Mutable<Node>).flags &= ~NodeFlags.Unreachable;
17941796
(node.label as Mutable<Node>).flags |= NodeFlags.Unreachable;
17951797
}
1798+
else {
1799+
// Clear Unreachable flag if label is now referenced (for incremental scenarios)
1800+
(node.label as Mutable<Node>).flags &= ~NodeFlags.Unreachable;
1801+
}
17961802
activeLabelList = activeLabelList.next;
17971803
addAntecedent(postStatementLabel, currentFlow);
17981804
currentFlow = finishFlowLabel(postStatementLabel);

0 commit comments

Comments
 (0)