Fix unreachable code detection persisting after incremental edits (#62783)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
This commit is contained in:
Copilot
2025-11-19 09:46:30 -08:00
committed by GitHub
parent cc2610fd34
commit 486fce7a12
3 changed files with 72 additions and 0 deletions

View File

@@ -1091,6 +1091,11 @@ 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;
// Clear Unreachable flag from previous binding (for incremental scenarios)
if (isPotentiallyExecutableNode(node)) {
(node as Mutable<Node>).flags &= ~NodeFlags.Unreachable;
}
if (currentFlow === unreachableFlow) {
if (canHaveFlowNode(node)) {
node.flowNode = undefined;