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 {
13411341 bind ( clause ) ;
13421342 fallthroughFlow = currentFlow ;
13431343 if ( ! ( currentFlow . flags & FlowFlags . Unreachable ) && i !== clauses . length - 1 && options . noFallthroughCasesInSwitch ) {
1344- errorOnFirstToken ( clause , Diagnostics . Fallthrough_case_in_switch ) ;
1344+ clause . fallthroughFlowNode = currentFlow ;
13451345 }
13461346 }
13471347 clauses . transformFlags = subtreeTransformFlags | TransformFlags . HasComputedFlags ;
Original file line number Diff line number Diff line change @@ -31079,6 +31079,9 @@ namespace ts {
3107931079 }
3108031080 }
3108131081 forEach(clause.statements, checkSourceElement);
31082+ if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) {
31083+ grammarErrorOnFirstToken(clause, Diagnostics.Fallthrough_case_in_switch);
31084+ }
3108231085 });
3108331086 if (node.caseBlock.locals) {
3108431087 registerForUnusedIdentifiersCheck(node.caseBlock);
Original file line number Diff line number Diff line change @@ -2250,12 +2250,14 @@ namespace ts {
22502250 parent : CaseBlock ;
22512251 expression : Expression ;
22522252 statements : NodeArray < Statement > ;
2253+ /* @internal */ fallthroughFlowNode ?: FlowNode ;
22532254 }
22542255
22552256 export interface DefaultClause extends Node {
22562257 kind : SyntaxKind . DefaultClause ;
22572258 parent : CaseBlock ;
22582259 statements : NodeArray < Statement > ;
2260+ /* @internal */ fallthroughFlowNode ?: FlowNode ;
22592261 }
22602262
22612263 export type CaseOrDefaultClause = CaseClause | DefaultClause ;
You can’t perform that action at this time.
0 commit comments