nitc :: FlowVisitor :: printflow
fun printflow
do
var file = new FileWriter.open("flow.dot")
file.write("digraph \{\nnode[shape=box];")
for f in flows do
var s = ""
if f.node isa AExpr then
s = "\\nmain={f.node.as(AExpr).after_flow_context.object_id}"
end
file.write "F{f.object_id} [label=\"{f.object_id}\\n{f.node.location}\\n{f.node.class_name}\\n{f.name}{s}\"];\n"
for p in f.previous do
s = ""
if f.when_true == p then s = "[label=TRUE, style=dotted]"
if f.when_false == p then s = "[label=FALSE, style=dotted]"
if f.when_true == p and f.when_false == p then s = "[label=TRUE_FALSE, style=dotted]"
file.write "F{p.object_id} -> F{f.object_id}{s};\n"
end
for p in f.loops do
file.write "F{p.object_id} -> F{f.object_id}[label=LOOP, style=dashed, constraint=false];\n"
end
end
file.write("\}\n")
file.close
end
src/semantize/flow.nit:78,2--101,4