[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.
|
||||
class ReturnPath(
|
||||
returnTargetSymbol: FirFunctionSymbol<*>
|
||||
) : EdgeLabel(label = "return@${returnTargetSymbol.callableId}")
|
||||
) : EdgeLabel(label = "\"return@${returnTargetSymbol.callableId}\"")
|
||||
|
||||
enum class EdgeKind(
|
||||
val usedInDfa: Boolean,
|
||||
|
||||
+7
-1
@@ -25,6 +25,8 @@ class FirControlFlowGraphRenderVisitor(
|
||||
private const val RED = "red"
|
||||
private const val BLUE = "blue"
|
||||
|
||||
private val DIGIT_REGEX = """\d""".toRegex()
|
||||
|
||||
private val EDGE_STYLE = EnumMap(
|
||||
mapOf(
|
||||
EdgeKind.Forward to "",
|
||||
@@ -47,8 +49,12 @@ class FirControlFlowGraphRenderVisitor(
|
||||
private val allGraphs = mutableSetOf<ControlFlowGraph>()
|
||||
|
||||
override fun visitFile(file: FirFile) {
|
||||
var name = file.name.replace(".", "_")
|
||||
if (DIGIT_REGEX.matches(name.first().toString())) {
|
||||
name = "_$name"
|
||||
}
|
||||
printer
|
||||
.println("digraph ${file.name.replace(".", "_")} {")
|
||||
.println("digraph $name {")
|
||||
.pushIndent()
|
||||
.println("graph [nodesep=3]")
|
||||
.println("node [shape=box penwidth=2]")
|
||||
|
||||
Reference in New Issue
Block a user