Skip to content

Commit ba30fdc

Browse files
committed
Attach flow nodes only when allowUnreachableCode !== true
1 parent 9466025 commit ba30fdc

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/compiler/binder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ namespace ts {
672672
bindJSDoc(node);
673673
return;
674674
}
675-
if (node.kind >= SyntaxKind.FirstStatement && node.kind <= SyntaxKind.LastStatement) {
675+
if (node.kind >= SyntaxKind.FirstStatement && node.kind <= SyntaxKind.LastStatement && !options.allowUnreachableCode) {
676676
node.flowNode = currentFlow;
677677
}
678678
switch (node.kind) {

src/compiler/checker.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30539,8 +30539,7 @@ namespace ts {
3053930539
cancellationToken.throwIfCancellationRequested();
3054030540
}
3054130541
}
30542-
if (kind >= SyntaxKind.FirstStatement && kind <= SyntaxKind.LastStatement &&
30543-
!compilerOptions.allowUnreachableCode && node.flowNode && !isReachableFlowNode(node.flowNode)) {
30542+
if (kind >= SyntaxKind.FirstStatement && kind <= SyntaxKind.LastStatement && node.flowNode && !isReachableFlowNode(node.flowNode)) {
3054430543
errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, Diagnostics.Unreachable_code_detected);
3054530544
}
3054630545

0 commit comments

Comments
 (0)