-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug(common): include derived types in dependency graph (#90)
* bug(common): include derived types in dependency graph Signed-off-by: Sanket Shevkar <[email protected]> * bug(common): include derived types in dependency graph Signed-off-by: Sanket Shevkar <[email protected]> --------- Signed-off-by: Sanket Shevkar <[email protected]> Co-authored-by: Sanket Shevkar <[email protected]>
- Loading branch information
1 parent
14aeb8b
commit 16d9d5a
Showing
2 changed files
with
81 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,12 +143,22 @@ class DirectedGraph { | |
*/ | ||
print(writer) { | ||
writer.writeLine(0, 'flowchart LR'); | ||
const diagramNodeSet = new Set(); | ||
Object.entries(this.adjacencyMap).forEach(([source, edges]) =>{ | ||
writer.writeLine(1, `\`${source}\``); | ||
diagramNodeSet.add( `\`${source}\``); | ||
(edges || []).forEach(target => { | ||
writer.writeLine(1, `\`${source}\` --> \`${target}\``); | ||
const setEntry = `\`${source}\` --> \`${target}\``; | ||
if(diagramNodeSet.has(`\`${target}\` --> \`${source}\``)) { | ||
diagramNodeSet.delete(`\`${target}\` --> \`${source}\``); | ||
diagramNodeSet.add(`\`${source}\` <--> \`${target}\``); | ||
} else { | ||
diagramNodeSet.add(setEntry); | ||
} | ||
}); | ||
}); | ||
diagramNodeSet.forEach((diagramNode) => { | ||
writer.writeLine(1, diagramNode); | ||
}); | ||
} | ||
} | ||
|
||
|
@@ -174,8 +184,12 @@ class ConcertoGraphVisitor extends DiagramVisitor { | |
|
||
if (classDeclaration.getSuperType()){ | ||
parameters.graph.addEdge(classDeclaration.getFullyQualifiedName(), classDeclaration.getSuperType()); | ||
// this "if" block adds the types that extend the Super type | ||
if(classDeclaration.getSuperType() !== '[email protected]') { | ||
parameters.graph.addVertex(classDeclaration.getSuperType()); | ||
parameters.graph.addEdge(classDeclaration.getSuperType(), classDeclaration.getFullyQualifiedName()); | ||
} | ||
} | ||
|
||
super.visitClassDeclaration(classDeclaration, parameters); | ||
parameters.stack.pop(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters