Skip to content

Commit a8a8826

Browse files
committed
Exclude FlowSwitchClause from flow graph for case expressions
1 parent c2730ce commit a8a8826

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/compiler/binder.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,9 @@ namespace ts {
551551
case SyntaxKind.CaseBlock:
552552
bindCaseBlock(<CaseBlock>node);
553553
break;
554+
case SyntaxKind.CaseClause:
555+
bindCaseClause(<CaseClause>node);
556+
break;
554557
case SyntaxKind.LabeledStatement:
555558
bindLabeledStatement(<LabeledStatement>node);
556559
break;
@@ -989,6 +992,14 @@ namespace ts {
989992
}
990993
}
991994

995+
function bindCaseClause(node: CaseClause): void {
996+
const saveCurrentFlow = currentFlow;
997+
currentFlow = preSwitchCaseFlow;
998+
bind(node.expression);
999+
currentFlow = saveCurrentFlow;
1000+
forEach(node.statements, bind);
1001+
}
1002+
9921003
function pushActiveLabel(name: string, breakTarget: FlowLabel, continueTarget: FlowLabel): ActiveLabel {
9931004
const activeLabel = {
9941005
name,

0 commit comments

Comments
 (0)