MCPcopy Index your code
hub / github.com/angular/components / getInheritedDocsOfClass

Function getInheritedDocsOfClass

tools/dgeni/common/class-inheritance.ts:31–55  ·  view source on GitHub ↗
(
  doc: ClassLikeExportDoc,
  exportSymbolsToDocsMap: Map<ts.Symbol, ClassLikeExportDoc>,
)

Source from the content-addressed store, hash-verified

29
30/** Gets all class like export documents which the given doc inherits from. */
31export function getInheritedDocsOfClass(
32 doc: ClassLikeExportDoc,
33 exportSymbolsToDocsMap: Map<ts.Symbol, ClassLikeExportDoc>,
34): ClassLikeExportDoc[] {
35 const result: ClassLikeExportDoc[] = [];
36 const typeChecker = doc.typeChecker;
37 for (let info of doc.extendsClauses) {
38 if (info.doc) {
39 result.push(info.doc, ...getInheritedDocsOfClass(info.doc, exportSymbolsToDocsMap));
40 } else if (info.type) {
41 // If the heritage info has not been resolved to a Dgeni API document, we try to
42 // interpret the type expression and resolve/create corresponding Dgeni API documents.
43 // An example is the use of mixins. Type-wise mixins are not like real classes, because
44 // they are composed through an intersection type. In order to handle this pattern, we
45 // need to handle intersection types manually and resolve them to Dgeni API documents.
46 const resolvedType = typeChecker.getTypeAtLocation(info.type);
47 const docs = getClassLikeDocsFromType(resolvedType, doc, exportSymbolsToDocsMap);
48 // Add direct class-like types resolved from the expression.
49 result.push(...docs);
50 // Resolve inherited docs of the resolved documents.
51 docs.forEach(d => result.push(...getInheritedDocsOfClass(d, exportSymbolsToDocsMap)));
52 }
53 }
54 return result;
55}
56
57/**
58 * Gets all class-like Dgeni documents from the given type. e.g. intersection types of

Callers 3

$processMethod · 0.90
_decorateClassDocMethod · 0.90

Calls 2

getClassLikeDocsFromTypeFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…