Skip to content

Commit 07642f0

Browse files
committed
Address feedback
1 parent a0a1736 commit 07642f0

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

tools/dgeni/processors/categorizer.js

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,23 @@ module.exports = function categorizer() {
1010
return {
1111
$runBefore: ['docs-processed'],
1212
$process: function (docs) {
13-
docs.filter(doc => doc.docType === 'class').forEach(doc => visitClassDoc(doc));
13+
docs.filter(doc => doc.docType === 'class').forEach(doc => decorateClassDoc(doc));
1414
}
1515
};
1616

17-
function visitClassDoc(classDoc) {
17+
/**
18+
* Decorates all class docs inside of the dgeni pipeline.
19+
* - Methods and properties of a class-doc will be extracted into separate variables.
20+
* - Identifies directives, services or NgModules and marks them them in class-doc.
21+
**/
22+
function decorateClassDoc(classDoc) {
1823
// Resolve all methods and properties from the classDoc. Includes inherited docs.
1924
classDoc.methods = resolveMethods(classDoc);
2025
classDoc.properties = resolveProperties(classDoc);
2126

22-
// Call visit hooks that can modify the method and property docs.
23-
classDoc.methods.forEach(doc => visitMethodDoc(doc));
24-
classDoc.properties.forEach(doc => visitPropertyDoc(doc));
27+
// Call decorate hooks that can modify the method and property docs.
28+
classDoc.methods.forEach(doc => decorateMethodDoc(doc));
29+
classDoc.properties.forEach(doc => decoratePropertyDoc(doc));
2530

2631
// Categorize the current visited classDoc into its Angular type.
2732
if (isDirective(classDoc)) {
@@ -34,14 +39,22 @@ module.exports = function categorizer() {
3439
}
3540
}
3641

37-
function visitMethodDoc(methodDoc) {
42+
/**
43+
* Method that will be called for each method doc. The parameters for the method-docs
44+
* will be normalized, so that they can be easily used inside of dgeni templates.
45+
**/
46+
function decorateMethodDoc(methodDoc) {
3847
normalizeMethodParameters(methodDoc);
3948

4049
// Mark methods with a `void` return type so we can omit show the return type in the docs.
4150
methodDoc.showReturns = methodDoc.returnType && methodDoc.returnType != 'void';
4251
}
4352

44-
function visitPropertyDoc(propertyDoc) {
53+
/**
54+
* Method that will be called for each property doc. Properties that are Angular inputs or
55+
* outputs will be marked. Aliases for the inputs or outputs will be stored as well.
56+
**/
57+
function decoratePropertyDoc(propertyDoc) {
4558
propertyDoc.isDirectiveInput = isDirectiveInput(propertyDoc);
4659
propertyDoc.directiveInputAlias = getDirectiveInputAlias(propertyDoc);
4760

tools/dgeni/processors/link-inherited-docs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = function linkInheritedDocs(readTypeScriptModules, tsParser) {
4040
}
4141

4242
function resolveInheritedType(classSymbol) {
43+
// Ensure that the symbol can be converted into a TypeScript ClassDeclaration.
4344
if (classSymbol.flags & ~ts.SymbolFlags.Class) {
4445
return;
4546
}

0 commit comments

Comments
 (0)