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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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;

View File

@ -0,0 +1,13 @@
/// <reference path="fourslash.ts" />
//// function test() {
//// return/*a*/abc();
//// return;
//// }
//// function abc() { }
verify.numberOfErrorsInCurrentFile(1);
goTo.marker("a")
edit.insert(" ");
verify.noErrors();