Commit 42fa1f43 authored by Vitja Makarov's avatar Vitja Makarov

Fix cf problem with loops inside else clause of another one loop

parent 3b925951
...@@ -718,6 +718,7 @@ class CreateControlFlowGraph(CythonTransform): ...@@ -718,6 +718,7 @@ class CreateControlFlowGraph(CythonTransform):
# Body block # Body block
self.flow.nextblock() self.flow.nextblock()
self.visit(node.body) self.visit(node.body)
self.flow.loops.pop()
# Loop it # Loop it
if self.flow.block: if self.flow.block:
self.flow.block.add_child(condition_block) self.flow.block.add_child(condition_block)
...@@ -730,7 +731,6 @@ class CreateControlFlowGraph(CythonTransform): ...@@ -730,7 +731,6 @@ class CreateControlFlowGraph(CythonTransform):
self.flow.block.add_child(next_block) self.flow.block.add_child(next_block)
else: else:
condition_block.add_child(next_block) condition_block.add_child(next_block)
self.flow.loops.pop()
self.flow.block = next_block self.flow.block = next_block
return node return node
...@@ -746,6 +746,7 @@ class CreateControlFlowGraph(CythonTransform): ...@@ -746,6 +746,7 @@ class CreateControlFlowGraph(CythonTransform):
# Body block # Body block
self.flow.nextblock() self.flow.nextblock()
self.visit(node.body) self.visit(node.body)
self.flow.loops.pop()
# Loop it # Loop it
if self.flow.block: if self.flow.block:
self.flow.block.add_child(condition_block) self.flow.block.add_child(condition_block)
...@@ -757,7 +758,6 @@ class CreateControlFlowGraph(CythonTransform): ...@@ -757,7 +758,6 @@ class CreateControlFlowGraph(CythonTransform):
self.flow.block.add_child(next_block) self.flow.block.add_child(next_block)
else: else:
condition_block.add_child(next_block) condition_block.add_child(next_block)
self.flow.loops.pop()
self.flow.block = next_block self.flow.block = next_block
return node return node
...@@ -777,6 +777,7 @@ class CreateControlFlowGraph(CythonTransform): ...@@ -777,6 +777,7 @@ class CreateControlFlowGraph(CythonTransform):
# Body block # Body block
self.flow.nextblock() self.flow.nextblock()
self.visit(node.body) self.visit(node.body)
self.flow.loops.pop()
# Loop it # Loop it
if self.flow.block: if self.flow.block:
self.flow.block.add_child(condition_block) self.flow.block.add_child(condition_block)
...@@ -788,7 +789,6 @@ class CreateControlFlowGraph(CythonTransform): ...@@ -788,7 +789,6 @@ class CreateControlFlowGraph(CythonTransform):
self.flow.block.add_child(next_block) self.flow.block.add_child(next_block)
else: else:
condition_block.add_child(next_block) condition_block.add_child(next_block)
self.flow.loops.pop()
self.flow.block = next_block self.flow.block = next_block
return node return node
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment