[FIR] Fix rendering of labels for return edgeds in CFG
This commit is contained in:
+1
-1
@@ -143,7 +143,7 @@ object UncaughtExceptionPath : EdgeLabel(label = "onUncaughtException")
|
|||||||
// TODO: Label `return`ing edge with this.
|
// TODO: Label `return`ing edge with this.
|
||||||
class ReturnPath(
|
class ReturnPath(
|
||||||
returnTargetSymbol: FirFunctionSymbol<*>
|
returnTargetSymbol: FirFunctionSymbol<*>
|
||||||
) : EdgeLabel(label = "return@${returnTargetSymbol.callableId}")
|
) : EdgeLabel(label = "\"return@${returnTargetSymbol.callableId}\"")
|
||||||
|
|
||||||
enum class EdgeKind(
|
enum class EdgeKind(
|
||||||
val usedInDfa: Boolean,
|
val usedInDfa: Boolean,
|
||||||
|
|||||||
+7
-1
@@ -25,6 +25,8 @@ class FirControlFlowGraphRenderVisitor(
|
|||||||
private const val RED = "red"
|
private const val RED = "red"
|
||||||
private const val BLUE = "blue"
|
private const val BLUE = "blue"
|
||||||
|
|
||||||
|
private val DIGIT_REGEX = """\d""".toRegex()
|
||||||
|
|
||||||
private val EDGE_STYLE = EnumMap(
|
private val EDGE_STYLE = EnumMap(
|
||||||
mapOf(
|
mapOf(
|
||||||
EdgeKind.Forward to "",
|
EdgeKind.Forward to "",
|
||||||
@@ -47,8 +49,12 @@ class FirControlFlowGraphRenderVisitor(
|
|||||||
private val allGraphs = mutableSetOf<ControlFlowGraph>()
|
private val allGraphs = mutableSetOf<ControlFlowGraph>()
|
||||||
|
|
||||||
override fun visitFile(file: FirFile) {
|
override fun visitFile(file: FirFile) {
|
||||||
|
var name = file.name.replace(".", "_")
|
||||||
|
if (DIGIT_REGEX.matches(name.first().toString())) {
|
||||||
|
name = "_$name"
|
||||||
|
}
|
||||||
printer
|
printer
|
||||||
.println("digraph ${file.name.replace(".", "_")} {")
|
.println("digraph $name {")
|
||||||
.pushIndent()
|
.pushIndent()
|
||||||
.println("graph [nodesep=3]")
|
.println("graph [nodesep=3]")
|
||||||
.println("node [shape=box penwidth=2]")
|
.println("node [shape=box penwidth=2]")
|
||||||
|
|||||||
Reference in New Issue
Block a user