mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-11 09:24:19 -06:00
Fix flow node improper reuse (#60662)
This commit is contained in:
parent
9bf5aa7fe2
commit
6b1ea96b94
@ -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;
|
||||
|
||||
13
tests/cases/fourslash/unreachableStatementNodeReuse.ts
Normal file
13
tests/cases/fourslash/unreachableStatementNodeReuse.ts
Normal 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();
|
||||
Loading…
x
Reference in New Issue
Block a user