MCPcopy
hub / github.com/angular/components / _decorateClassDoc

Method _decorateClassDoc

tools/dgeni/processors/categorizer.ts:111–154  ·  view source on GitHub ↗

* Decorates all Dgeni class documents for a simpler use inside of the template. * - Identifies directives, services, NgModules or harnesses and marks them them * inside of the doc. * - Links the Dgeni document to the Dgeni document that the current class extends from.

(classDoc: CategorizedClassDoc)

Source from the content-addressed store, hash-verified

109 * - Links the Dgeni document to the Dgeni document that the current class extends from.
110 */
111 private _decorateClassDoc(classDoc: CategorizedClassDoc) {
112 // Classes can only extend a single class. This means that there can't be multiple extend
113 // clauses for the Dgeni document. To make the template syntax simpler and more readable,
114 // store the extended class in a variable.
115 classDoc.extendedDoc = classDoc.extendsClauses[0] ? classDoc.extendsClauses[0].doc! : undefined;
116 classDoc.metadata = getMetadata(classDoc);
117 classDoc.inheritedDocs = getInheritedDocsOfClass(classDoc, this._exportSymbolsToDocsMap);
118
119 classDoc.methods.push(
120 ...(classDoc.statics
121 .filter(isMethod)
122 .filter(filterDuplicateMembers) as CategorizedMethodMemberDoc[]),
123 );
124
125 classDoc.properties.push(
126 ...(classDoc.statics
127 .filter(isProperty)
128 .filter(filterDuplicateMembers) as CategorizedPropertyMemberDoc[]),
129 );
130
131 // In case the extended document is not public, we don't want to print it in the
132 // rendered class API doc. This causes confusion and also is not helpful as the
133 // extended document is not part of the docs and cannot be viewed.
134 if (classDoc.extendedDoc !== undefined && !isPublicDoc(classDoc.extendedDoc)) {
135 classDoc.extendedDoc = undefined;
136 }
137
138 // Categorize the current visited classDoc into its Angular type.
139 if (isComponent(classDoc) && classDoc.metadata) {
140 classDoc.isComponent = true;
141 classDoc.exportAs = classDoc.metadata.get('exportAs');
142 classDoc.selectors = getSelectors(classDoc);
143 } else if (isDirective(classDoc) && classDoc.metadata) {
144 classDoc.isDirective = true;
145 classDoc.exportAs = classDoc.metadata.get('exportAs');
146 classDoc.selectors = getSelectors(classDoc);
147 } else if (isService(classDoc)) {
148 classDoc.isService = true;
149 } else if (isNgModule(classDoc)) {
150 classDoc.isNgModule = true;
151 } else if (this._isTestHarness(classDoc)) {
152 classDoc.isTestHarness = true;
153 }
154 }
155
156 /**
157 * Method that will be called for each method doc. The parameters for the method-docs

Callers 1

_decorateClassLikeDocMethod · 0.95

Calls 12

_isTestHarnessMethod · 0.95
getMetadataFunction · 0.90
getInheritedDocsOfClassFunction · 0.90
isPublicDocFunction · 0.90
isComponentFunction · 0.90
getSelectorsFunction · 0.90
isDirectiveFunction · 0.90
isServiceFunction · 0.90
isNgModuleFunction · 0.90
pushMethod · 0.65
getMethod · 0.65
filterMethod · 0.45

Tested by

no test coverage detected