Skip to content

Remove redundant call to checkNodeDeferred #22516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
2 commits merged into from
Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ namespace ts {

let deferredNodes: Node[];
let deferredUnusedIdentifierNodes: Node[];
const seenDeferredUnusedIdentifiers = createMap<true>(); // For assertion that we don't defer the same identifier twice

let flowLoopStart = 0;
let flowLoopCount = 0;
Expand Down Expand Up @@ -18674,7 +18675,6 @@ namespace ts {

// The identityMapper object is used to indicate that function expressions are wildcards
if (checkMode === CheckMode.SkipContextSensitive && isContextSensitive(node)) {
checkNodeDeferred(node);
return anyFunctionType;
}

Expand Down Expand Up @@ -21564,6 +21564,7 @@ namespace ts {

function registerForUnusedIdentifiersCheck(node: Node) {
if (deferredUnusedIdentifierNodes) {
Debug.assert(addToSeen(seenDeferredUnusedIdentifiers, getNodeId(node)), "Deferring unused identifier check twice");
deferredUnusedIdentifierNodes.push(node);
}
}
Expand Down Expand Up @@ -24573,6 +24574,7 @@ namespace ts {
}

deferredNodes = undefined;
seenDeferredUnusedIdentifiers.clear();
deferredUnusedIdentifierNodes = undefined;

if (isExternalOrCommonJsModule(node)) {
Expand Down
10 changes: 10 additions & 0 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3839,6 +3839,16 @@ namespace ts {
export function showModuleSpecifier({ moduleSpecifier }: ImportDeclaration): string {
return isStringLiteral(moduleSpecifier) ? moduleSpecifier.text : getTextOfNode(moduleSpecifier);
}

/** Add a value to a set, and return true if it wasn't already present. */
export function addToSeen(seen: Map<true>, key: string | number): boolean {
key = String(key);
if (seen.has(key)) {
return false;
}
seen.set(key, true);
return true;
}
}

namespace ts {
Expand Down
10 changes: 0 additions & 10 deletions src/services/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1205,16 +1205,6 @@ namespace ts {
};
}

/** Add a value to a set, and return true if it wasn't already present. */
export function addToSeen(seen: Map<true>, key: string | number): boolean {
key = String(key);
if (seen.has(key)) {
return false;
}
seen.set(key, true);
return true;
}

export function getSnapshotText(snap: IScriptSnapshot): string {
return snap.getText(0, snap.getLength());
}
Expand Down