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

Function explicitlyInheritsFrom

test/fixtures/snapshot/typescript.js:138528–138547  ·  view source on GitHub ↗

* Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol * is an interface, determines if some ancestor of the child symbol extends or inherits from it. * Also takes in a cache of previous results which makes this slightly more effici

(symbol, parent, cachedResults, checker)

Source from the content-addressed store, hash-verified

138526 * @param cachedResults A map of symbol id pairs (i.e. "child,parent") to booleans indicating previous results
138527 */
138528 function explicitlyInheritsFrom(symbol, parent, cachedResults, checker) {
138529 if (symbol === parent) {
138530 return true;
138531 }
138532 var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent);
138533 var cached = cachedResults.get(key);
138534 if (cached !== undefined) {
138535 return cached;
138536 }
138537 // Set the key so that we don't infinitely recurse
138538 cachedResults.set(key, false);
138539 var inherits = !!symbol.declarations && symbol.declarations.some(function (declaration) {
138540 return ts.getAllSuperTypeNodes(declaration).some(function (typeReference) {
138541 var type = checker.getTypeAtLocation(typeReference);
138542 return !!type && !!type.symbol && explicitlyInheritsFrom(type.symbol, parent, cachedResults, checker);
138543 });
138544 });
138545 cachedResults.set(key, inherits);
138546 return inherits;
138547 }
138548 function getReferencesForSuperKeyword(superKeyword) {
138549 var searchSpaceNode = ts.getSuperContainer(superKeyword, /*stopOnFunctions*/ false);
138550 if (!searchSpaceNode) {

Callers 1

getRelatedSymbolFunction · 0.85

Calls 3

someMethod · 0.80
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected