Fix flow node improper reuse (#60662)

This commit is contained in:
Gabriela Araujo Britto
2024-12-04 09:13:13 -08:00
committed by GitHub
parent 9bf5aa7fe2
commit 6b1ea96b94
2 changed files with 17 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import {
BreakOrContinueStatement,
CallChain,
CallExpression,
canHaveFlowNode,
canHaveLocals,
canHaveSymbol,
CaseBlock,
@@ -1104,6 +1105,9 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
// and set it before we descend into nodes that could actually be part of an assignment pattern.
inAssignmentPattern = false;
if (checkUnreachable(node)) {
if (canHaveFlowNode(node) && node.flowNode) {
node.flowNode = undefined;
}
bindEachChild(node);
bindJSDoc(node);
inAssignmentPattern = saveInAssignmentPattern;