Skip to content

Refactor wrapSymbolTrackerToReportForContext to improve perf #51788

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

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ tests/cases/user/puppeteer/puppeteer
tests/cases/user/axios-src/axios-src
tests/cases/user/prettier/prettier
.eslintcache
*v8.log
286 changes: 186 additions & 100 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5115,7 +5115,7 @@ export interface SymbolWalker {

// This was previously deprecated in our public API, but is still used internally
/** @internal */
export interface SymbolWriter extends SymbolTracker {
export interface SymbolWriter {
writeKeyword(text: string): void;
writeOperator(text: string): void;
writePunctuation(text: string): void;
Expand Down
8 changes: 0 additions & 8 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,6 @@ function createSingleLineStringWriter(): EmitTextWriter {
increaseIndent: noop,
decreaseIndent: noop,
clear: () => str = "",
trackSymbol: () => false,
reportInaccessibleThisError: noop,
reportInaccessibleUniqueSymbolError: noop,
reportPrivateInBaseOfClassExpression: noop,
};
}

Expand Down Expand Up @@ -5162,10 +5158,6 @@ export function createTextWriter(newLine: string): EmitTextWriter {
hasTrailingComment: () => hasTrailingComment,
hasTrailingWhitespace: () => !!output.length && isWhiteSpaceLike(output.charCodeAt(output.length - 1)),
clear: reset,
reportInaccessibleThisError: noop,
reportPrivateInBaseOfClassExpression: noop,
reportInaccessibleUniqueSymbolError: noop,
trackSymbol: () => false,
writeKeyword: write,
writeOperator: write,
writeParameter: write,
Expand Down
2 changes: 1 addition & 1 deletion src/services/inlayHints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
const printer = createPrinter(options);

return usingSingleLineStringWriter(writer => {
const typeNode = checker.typeToTypeNode(type, /*enclosingDeclaration*/ undefined, flags, writer);
const typeNode = checker.typeToTypeNode(type, /*enclosingDeclaration*/ undefined, flags);
Debug.assertIsDefined(typeNode, "should always get typenode");
printer.writeNode(EmitHint.Unspecified, typeNode, /*sourceFile*/ file, writer);
});
Expand Down
5 changes: 0 additions & 5 deletions src/services/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ import {
nodeIsMissing,
nodeIsPresent,
nodeIsSynthesized,
noop,
normalizePath,
NoSubstitutionTemplateLiteral,
notImplemented,
Expand Down Expand Up @@ -2721,10 +2720,6 @@ function getDisplayPartWriter(): DisplayPartsSymbolWriter {
increaseIndent: () => { indent++; },
decreaseIndent: () => { indent--; },
clear: resetWriter,
trackSymbol: () => false,
reportInaccessibleThisError: noop,
reportInaccessibleUniqueSymbolError: noop,
reportPrivateInBaseOfClassExpression: noop,
};

function writeIndent() {
Expand Down