fun printflow
do
var file = new FileWriter.open("flow.dot")
- file.write("digraph \{\n")
+ file.write("digraph \{\nnode[shape=box];")
for f in flows do
var s = ""
if f.node isa AExpr then
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
- file.write "F{p.object_id} -> F{f.object_id};\n"
+ 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
- if f.when_true != f then
- file.write "F{f.object_id} -> F{f.when_true.object_id}[label=TRUE, style=dotted];\n"
- end
- if f.when_false != f then
- file.write "F{f.object_id} -> F{f.when_false.object_id}[label=FALSE,style=dotted];\n"
+ 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")
redef class AForExpr
redef fun accept_flow_visitor(v)
do
- v.enter_visit(self.n_expr)
+ for g in n_groups do
+ v.enter_visit(g.n_expr)
+ end
var before_loop = v.make_sub_flow