MCPcopy Create free account
hub / github.com/nodejs/node / getRelatedSymbol

Function getRelatedSymbol

test/fixtures/snapshot/typescript.js:138834–138853  ·  view source on GitHub ↗
(search, referenceSymbol, referenceLocation, state)

Source from the content-addressed store, hash-verified

138832 return !!(modifierFlags & 32 /* ModifierFlags.Static */);
138833 }
138834 function getRelatedSymbol(search, referenceSymbol, referenceLocation, state) {
138835 var checker = state.checker;
138836 return forEachRelatedSymbol(referenceSymbol, referenceLocation, checker, /*isForRenamePopulateSearchSymbolSet*/ false,
138837 /*onlyIncludeBindingElementAtReferenceLocation*/ state.options.use !== 2 /* FindReferencesUse.Rename */ || !!state.options.providePrefixAndSuffixTextForRename, function (sym, rootSymbol, baseSymbol, kind) {
138838 // check whether the symbol used to search itself is just the searched one.
138839 if (baseSymbol) {
138840 // static method/property and instance method/property might have the same name. Only check static or only check instance.
138841 if (isStaticSymbol(referenceSymbol) !== isStaticSymbol(baseSymbol)) {
138842 baseSymbol = undefined;
138843 }
138844 }
138845 return search.includes(baseSymbol || rootSymbol || sym)
138846 // For a base type, use the symbol for the derived type. For a synthetic (e.g. union) property, use the union symbol.
138847 ? { symbol: rootSymbol && !(ts.getCheckFlags(sym) & 6 /* CheckFlags.Synthetic */) ? rootSymbol : sym, kind: kind }
138848 : undefined;
138849 },
138850 /*allowBaseTypes*/ function (rootSymbol) {
138851 return !(search.parents && !search.parents.some(function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker); }));
138852 });
138853 }
138854 /**
138855 * Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations
138856 * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class

Callers 1

getReferencesAtLocationFunction · 0.85

Calls 5

forEachRelatedSymbolFunction · 0.85
isStaticSymbolFunction · 0.85
explicitlyInheritsFromFunction · 0.85
includesMethod · 0.80
someMethod · 0.80

Tested by

no test coverage detected