ni_nitdoc: added fast copy past utility to signatures.
[nit.git] / src / flow.nit
index 75ee48a..cdc5ece 100644 (file)
@@ -20,6 +20,17 @@ module flow
 import parser
 import toolcontext
 import scope
+import phase
+
+redef class ToolContext
+       var flow_phase: Phase = new FlowPhase(self, [scope_phase])
+end
+
+private class FlowPhase
+       super Phase
+
+       redef fun process_npropdef(npropdef) do npropdef.do_flow(toolcontext)
+end
 
 # The visitor that derermine flowcontext for nodes
 private class FlowVisitor
@@ -49,8 +60,10 @@ private class FlowVisitor
                        if node isa AExpr then
                                var flow = self.current_flow_context
                                node.after_flow_context = flow
+                               # Force the creation of a specific merge after the analysis of the node.
                                if flow.when_true != flow or flow.when_false != flow then
-                                       #self.make_sub_flow
+                                       self.make_sub_flow
+                                       self.current_flow_context.name = "AUTOSUB"
                                end
                        end
 
@@ -88,7 +101,7 @@ private class FlowVisitor
                                file.write "F{f.object_id} -> F{f.when_false.object_id}[label=FALSE,style=dotted];\n"
                        end
                end
-               file.write("\n")
+               file.write("\}\n")
                file.close
        end
 
@@ -552,3 +565,11 @@ redef class AIsaExpr
                v.make_sub_true_false_flow
        end
 end
+
+redef class AProxyExpr
+       redef fun accept_flow_visitor(v)
+       do
+               var after_expr = v.visit_expr(self.n_expr)
+               v.current_flow_context = after_expr
+       end
+end