[FIR] Drop duplicate edges in fir tree graph
This commit is contained in:
+13
-1
@@ -36,6 +36,12 @@ private fun printInterfaceClassGraph(builder: AbstractFirTreeBuilder) {
|
||||
}
|
||||
val elements = builder.elements + builder.elements.flatMap { it.allParents }
|
||||
|
||||
data class Edge(val from: String, val to: String) {
|
||||
override fun toString(): String {
|
||||
return "$from -> $to"
|
||||
}
|
||||
}
|
||||
|
||||
File("FirTree.dot").printWriter().use { printer ->
|
||||
with(printer) {
|
||||
println("digraph FirTree {")
|
||||
@@ -43,11 +49,17 @@ private fun printInterfaceClassGraph(builder: AbstractFirTreeBuilder) {
|
||||
println(" ${it.type} [color=${it.kind!!.toColor()}]")
|
||||
}
|
||||
println()
|
||||
val edges = mutableSetOf<Edge>()
|
||||
elements.forEach { element ->
|
||||
element.allParents.forEach { parent ->
|
||||
println(" ${parent.type} -> ${element.type}")
|
||||
edges += Edge(parent.type, element.type)
|
||||
}
|
||||
}
|
||||
edges.forEach {
|
||||
print(" ")
|
||||
println(it)
|
||||
}
|
||||
|
||||
println("}")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user