Skip to content

Commit f9d7f85

Browse files
committed
Refactor wrapSymbolTrackerToReportForContext to improve perf
1 parent af1d91d commit f9d7f85

File tree

6 files changed

+189
-115
lines changed

6 files changed

+189
-115
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,4 @@ tests/cases/user/puppeteer/puppeteer
8484
tests/cases/user/axios-src/axios-src
8585
tests/cases/user/prettier/prettier
8686
.eslintcache
87+
*v8.log

src/compiler/checker.ts

Lines changed: 186 additions & 100 deletions
Large diffs are not rendered by default.

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5115,7 +5115,7 @@ export interface SymbolWalker {
51155115

51165116
// This was previously deprecated in our public API, but is still used internally
51175117
/** @internal */
5118-
export interface SymbolWriter extends SymbolTracker {
5118+
export interface SymbolWriter {
51195119
writeKeyword(text: string): void;
51205120
writeOperator(text: string): void;
51215121
writePunctuation(text: string): void;

src/compiler/utilities.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -600,10 +600,6 @@ function createSingleLineStringWriter(): EmitTextWriter {
600600
increaseIndent: noop,
601601
decreaseIndent: noop,
602602
clear: () => str = "",
603-
trackSymbol: () => false,
604-
reportInaccessibleThisError: noop,
605-
reportInaccessibleUniqueSymbolError: noop,
606-
reportPrivateInBaseOfClassExpression: noop,
607603
};
608604
}
609605

@@ -5162,10 +5158,6 @@ export function createTextWriter(newLine: string): EmitTextWriter {
51625158
hasTrailingComment: () => hasTrailingComment,
51635159
hasTrailingWhitespace: () => !!output.length && isWhiteSpaceLike(output.charCodeAt(output.length - 1)),
51645160
clear: reset,
5165-
reportInaccessibleThisError: noop,
5166-
reportPrivateInBaseOfClassExpression: noop,
5167-
reportInaccessibleUniqueSymbolError: noop,
5168-
trackSymbol: () => false,
51695161
writeKeyword: write,
51705162
writeOperator: write,
51715163
writeParameter: write,

src/services/inlayHints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
387387
const printer = createPrinter(options);
388388

389389
return usingSingleLineStringWriter(writer => {
390-
const typeNode = checker.typeToTypeNode(type, /*enclosingDeclaration*/ undefined, flags, writer);
390+
const typeNode = checker.typeToTypeNode(type, /*enclosingDeclaration*/ undefined, flags);
391391
Debug.assertIsDefined(typeNode, "should always get typenode");
392392
printer.writeNode(EmitHint.Unspecified, typeNode, /*sourceFile*/ file, writer);
393393
});

src/services/utilities.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ import {
271271
nodeIsMissing,
272272
nodeIsPresent,
273273
nodeIsSynthesized,
274-
noop,
275274
normalizePath,
276275
NoSubstitutionTemplateLiteral,
277276
notImplemented,
@@ -2721,10 +2720,6 @@ function getDisplayPartWriter(): DisplayPartsSymbolWriter {
27212720
increaseIndent: () => { indent++; },
27222721
decreaseIndent: () => { indent--; },
27232722
clear: resetWriter,
2724-
trackSymbol: () => false,
2725-
reportInaccessibleThisError: noop,
2726-
reportInaccessibleUniqueSymbolError: noop,
2727-
reportPrivateInBaseOfClassExpression: noop,
27282723
};
27292724

27302725
function writeIndent() {

0 commit comments

Comments
 (0)