File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1341,7 +1341,7 @@ namespace ts {
1341
1341
bind ( clause ) ;
1342
1342
fallthroughFlow = currentFlow ;
1343
1343
if ( ! ( currentFlow . flags & FlowFlags . Unreachable ) && i !== clauses . length - 1 && options . noFallthroughCasesInSwitch ) {
1344
- errorOnFirstToken ( clause , Diagnostics . Fallthrough_case_in_switch ) ;
1344
+ clause . fallthroughFlowNode = currentFlow ;
1345
1345
}
1346
1346
}
1347
1347
clauses . transformFlags = subtreeTransformFlags | TransformFlags . HasComputedFlags ;
Original file line number Diff line number Diff line change @@ -31079,6 +31079,9 @@ namespace ts {
31079
31079
}
31080
31080
}
31081
31081
forEach(clause.statements, checkSourceElement);
31082
+ if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) {
31083
+ grammarErrorOnFirstToken(clause, Diagnostics.Fallthrough_case_in_switch);
31084
+ }
31082
31085
});
31083
31086
if (node.caseBlock.locals) {
31084
31087
registerForUnusedIdentifiersCheck(node.caseBlock);
Original file line number Diff line number Diff line change @@ -2250,12 +2250,14 @@ namespace ts {
2250
2250
parent : CaseBlock ;
2251
2251
expression : Expression ;
2252
2252
statements : NodeArray < Statement > ;
2253
+ /* @internal */ fallthroughFlowNode ?: FlowNode ;
2253
2254
}
2254
2255
2255
2256
export interface DefaultClause extends Node {
2256
2257
kind : SyntaxKind . DefaultClause ;
2257
2258
parent : CaseBlock ;
2258
2259
statements : NodeArray < Statement > ;
2260
+ /* @internal */ fallthroughFlowNode ?: FlowNode ;
2259
2261
}
2260
2262
2261
2263
export type CaseOrDefaultClause = CaseClause | DefaultClause ;
You can’t perform that action at this time.
0 commit comments