Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.jacodb.ets.graph.EtsCfg
private fun EtsStmt.toDotLabel(): String = when (this) {
is EtsNopStmt -> "nop"
is EtsAssignStmt -> "$lhv := $rhv"
is EtsReturnStmt -> "return $returnValue"
is EtsReturnStmt -> returnValue?.let { "return $it" } ?: "return"
is EtsIfStmt -> "if ($condition)"
else -> this.toString() // TODO: support more statement types
}
Expand All @@ -38,8 +38,9 @@ fun EtsCfg.toDot(): String {

// Nodes
stmts.forEach { stmt ->
val id= stmt.location.index
lines += " $id [label=\"$id: ${stmt.toDotLabel()}\"]"
val id = stmt.location.index
val label = stmt.toDotLabel().replace("\"", "\\\"")
lines += " $id [label=\"$id: $label\"]"
}

// Edges
Expand Down
Loading