Skip to content

Commit

Permalink
chore(*): add definition of how we use includeDerivedTypes in JSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammed-abdulkadir committed Nov 1, 2024
1 parent 13442eb commit c8a185d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/common/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ class ConcertoGraphVisitor extends BaseVisitor {
* Visitor design pattern
* @param {ClassDeclaration} classDeclaration - the object being visited
* @param {Object} parameters - the parameter
* @property {boolean} parameters.includeDerivedTypes - If this option is enabled, edges will be created from super types to their derived types.
* This guarantees that if type X exists in the model manager, all types that inherit from X will be represented in the graph.
* @protected
*/
visitClassDeclaration(classDeclaration, parameters) {
Expand All @@ -183,7 +185,7 @@ class ConcertoGraphVisitor extends BaseVisitor {
parameters.graph.addEdge(classDeclaration.getFullyQualifiedName(), classDeclaration.getSuperType());

// Adds a reverse edge to create a cyclic dependency between a class declaration and its supertype.
if(!parameters.createDependencyGraph && classDeclaration.getSuperType() !== '[email protected]') {
if(parameters.includeDerivedTypes && classDeclaration.getSuperType() !== '[email protected]') {
parameters.graph.addVertex(classDeclaration.getSuperType());
parameters.graph.addEdge(classDeclaration.getSuperType(), classDeclaration.getFullyQualifiedName());
}
Expand Down
2 changes: 1 addition & 1 deletion test/common/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe('graph', function() {
const graph = new DirectedGraph();
modelManager.accept(visitor, {
graph,
createDependencyGraph: true
includeDerivedTypes: true
});

expect(
Expand Down
2 changes: 2 additions & 0 deletions types/lib/common/graph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export class ConcertoGraphVisitor extends BaseVisitor {
* Visitor design pattern
* @param {ClassDeclaration} classDeclaration - the object being visited
* @param {Object} parameters - the parameter
* @property {boolean} parameters.includeDerivedTypes - If this option is enabled, edges will be created from super types to their derived types.
* This guarantees that if type X exists in the model manager, all types that inherit from X will be represented in the graph.
* @protected
*/
protected visitClassDeclaration(classDeclaration: ClassDeclaration, parameters: any): void;
Expand Down

0 comments on commit c8a185d

Please sign in to comment.