MCPcopy Index your code
hub / github.com/nodejs/node / getSuggestedSymbolForNonexistentSymbol

Function getSuggestedSymbolForNonexistentSymbol

test/fixtures/snapshot/typescript.js:74995–75018  ·  view source on GitHub ↗
(location, outerName, meaning)

Source from the content-addressed store, hash-verified

74993 return suggestion && ts.symbolName(suggestion);
74994 }
74995 function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
74996 ts.Debug.assert(outerName !== undefined, "outername should always be defined");
74997 var result = resolveNameHelper(location, outerName, meaning, /*nameNotFoundMessage*/ undefined, outerName, /*isUse*/ false, /*excludeGlobals*/ false, /*getSpellingSuggestions*/ true, function (symbols, name, meaning) {
74998 ts.Debug.assertEqual(outerName, name, "name should equal outerName");
74999 var symbol = getSymbol(symbols, name, meaning);
75000 // Sometimes the symbol is found when location is a return type of a function: `typeof x` and `x` is declared in the body of the function
75001 // So the table *contains* `x` but `x` isn't actually in scope.
75002 // However, resolveNameHelper will continue and call this callback again, so we'll eventually get a correct suggestion.
75003 if (symbol)
75004 return symbol;
75005 var candidates;
75006 if (symbols === globals) {
75007 var primitives = ts.mapDefined(["string", "number", "boolean", "object", "bigint", "symbol"], function (s) { return symbols.has((s.charAt(0).toUpperCase() + s.slice(1)))
75008 ? createSymbol(524288 /* SymbolFlags.TypeAlias */, s)
75009 : undefined; });
75010 candidates = primitives.concat(ts.arrayFrom(symbols.values()));
75011 }
75012 else {
75013 candidates = ts.arrayFrom(symbols.values());
75014 }
75015 return getSpellingSuggestionForName(ts.unescapeLeadingUnderscores(name), candidates, meaning);
75016 });
75017 return result;
75018 }
75019 function getSuggestionForNonexistentSymbol(location, outerName, meaning) {
75020 var symbolResult = getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning);
75021 return symbolResult && ts.symbolName(symbolResult);

Callers 3

createTypeCheckerFunction · 0.85
resolveNameHelperFunction · 0.85

Calls 9

resolveNameHelperFunction · 0.85
getSymbolFunction · 0.85
createSymbolFunction · 0.85
assertMethod · 0.80
concatMethod · 0.80
hasMethod · 0.65
sliceMethod · 0.65
valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…