changeset 213:a507d8d0c6ab

flow: handle for loops
author Sigurd Meldgaard <stm@daimi.au.dk>
date Tue, 22 Dec 2009 17:10:47 +0100
parents ab8d20c4309d
children c2f5f0ff0501
files pysmcl/flow.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/flow.py	Tue Dec 22 17:10:04 2009 +0100
+++ b/pysmcl/flow.py	Tue Dec 22 17:10:47 2009 +0100
@@ -114,6 +114,12 @@
                 self.make_edge(out_of_while, stm)
                 current = before | out_of_while | self.to_loop_exit
                 self.to_loop_exit = set()
+            elif isinstance(stm, ast.For):
+                before = current
+                out_of_while = self.flow_body(stm.body, set([stm]))
+                self.make_edge(out_of_while, stm)
+                current = before | out_of_while | self.to_loop_exit
+                self.to_loop_exit = set()
             elif isinstance(stm, ast.Break):
                 self.to_loop_exit = self.to_loop_exit | set([stm])
                 return set()