@@ -45924,6 +45924,9 @@ var ts;
4592445924 // extra cost of calling `getParseTreeNode` when calling these functions from inside the
4592545925 // checker.
4592645926 var checker = {
45927+ setSymbolChainCache: function (cache) {
45928+ nodeBuilder.setSymbolChainCache(cache);
45929+ },
4592745930 getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); },
4592845931 getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); },
4592945932 getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; },
@@ -49700,7 +49703,9 @@ var ts;
4970049703 return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 16777216 /* IsClassInstanceClone */)));
4970149704 }
4970249705 function createNodeBuilder() {
49706+ var symbolChainCache;
4970349707 return {
49708+ setSymbolChainCache: function (cache) { symbolChainCache = cache; },
4970449709 typeToTypeNode: function (type, enclosingDeclaration, flags, tracker) {
4970549710 return withContext(enclosingDeclaration, flags, tracker, function (context) { return typeToTypeNodeHelper(type, context); });
4970649711 },
@@ -49747,6 +49752,7 @@ var ts;
4974749752 fileExists: function (fileName) { return host.fileExists(fileName); },
4974849753 getFileIncludeReasons: function () { return host.getFileIncludeReasons(); },
4974949754 } : undefined },
49755+ cache: symbolChainCache,
4975049756 encounteredError: false,
4975149757 reportedDiagnostic: false,
4975249758 visitedTypes: undefined,
@@ -50742,6 +50748,29 @@ var ts;
5074250748 return chain;
5074350749 /** @param endOfChain Set to false for recursive calls; non-recursive calls should always output something. */
5074450750 function getSymbolChain(symbol, meaning, endOfChain) {
50751+ var key;
50752+ var result;
50753+ if (context.cache) {
50754+ key = {
50755+ symbol: symbol,
50756+ enclosingDeclaration: context.enclosingDeclaration,
50757+ flags: context.flags,
50758+ meaning: meaning,
50759+ yieldModuleSymbol: yieldModuleSymbol,
50760+ endOfChain: endOfChain
50761+ };
50762+ result = context.cache.lookup(key);
50763+ if (result) {
50764+ return result;
50765+ }
50766+ }
50767+ result = doGetSymbolChain(symbol, meaning, endOfChain);
50768+ if (result && key && context.cache) {
50769+ context.cache.cache(key, result);
50770+ }
50771+ return result;
50772+ }
50773+ function doGetSymbolChain(symbol, meaning, endOfChain) {
5074550774 var accessibleSymbolChain = getAccessibleSymbolChain(symbol, context.enclosingDeclaration, meaning, !!(context.flags & 128 /* UseOnlyExternalAliasing */));
5074650775 var parentSpecifiers;
5074750776 if (!accessibleSymbolChain ||
@@ -156796,10 +156825,11 @@ var ts;
156796156825 synchronizeHostData();
156797156826 return ts.Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, preferences);
156798156827 }
156799- function getQuickInfoAtPosition(fileName, position ) {
156828+ function getQuickInfoAtPosition(arg0, arg1 ) {
156800156829 synchronizeHostData();
156801- var sourceFile = getValidSourceFile(fileName);
156802- var node = ts.getTouchingPropertyName(sourceFile, position);
156830+ var sourceFile = typeof arg0 === 'string' ? getValidSourceFile(arg0) : (arg1 !== undefined) ? arg1 : arg0.getSourceFile();
156831+ var node = typeof arg0 === 'string' ? ts.getTouchingPropertyName(sourceFile, arg1) : arg0;
156832+ var position = typeof arg1 === 'number' ? arg1 : node.getStart(sourceFile, false);
156803156833 if (node === sourceFile) {
156804156834 // Avoid giving quickInfo for the sourceFile as a whole.
156805156835 return undefined;
@@ -157036,9 +157066,9 @@ var ts;
157036157066 // doesn't use compiler - no need to synchronize with host
157037157067 return ts.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span);
157038157068 }
157039- function getOutliningSpans(fileName ) {
157069+ function getOutliningSpans(arg0 ) {
157040157070 // doesn't use compiler - no need to synchronize with host
157041- var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName) ;
157071+ var sourceFile = typeof arg0 === 'string' ? syntaxTreeCache.getCurrentSourceFile(arg0) : arg0 ;
157042157072 return ts.OutliningElementsCollector.collectElements(sourceFile, cancellationToken);
157043157073 }
157044157074 var braceMatching = new ts.Map(ts.getEntries((_a = {},
@@ -158800,14 +158830,11 @@ var ts;
158800158830 return _this.realizeDiagnostics(diagnostics);
158801158831 });
158802158832 };
158803- /// QUICKINFO
158804- /**
158805- * Computes a string representation of the type at the requested position
158806- * in the active file.
158807- */
158808- LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) {
158833+ LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (arg0, arg1) {
158809158834 var _this = this;
158810- return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getQuickInfoAtPosition(fileName, position); });
158835+ var fileName = typeof arg0 === "string" ? arg0 : arg1 !== undefined ? arg1.fileName : arg0.getSourceFile().fileName;
158836+ var position = typeof arg0 === "string" ? arg1 : arg0.getStart(arg1);
158837+ return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getQuickInfoAtPosition(arg0, arg1); });
158811158838 };
158812158839 /// NAMEORDOTTEDNAMESPAN
158813158840 /**
@@ -158982,9 +159009,10 @@ var ts;
158982159009 var _this = this;
158983159010 return this.forwardJSONCall("getNavigationTree('" + fileName + "')", function () { return _this.languageService.getNavigationTree(fileName); });
158984159011 };
158985- LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName ) {
159012+ LanguageServiceShimObject.prototype.getOutliningSpans = function (arg0 ) {
158986159013 var _this = this;
158987- return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); });
159014+ var fileName = typeof arg0 === "string" ? arg0 : arg0.fileName;
159015+ return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(arg0); });
158988159016 };
158989159017 LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) {
158990159018 var _this = this;
0 commit comments