forked from M-Labs/artiq
1
0
Fork 0

transforms.iodelay_estimator: allow goto in zero-iodelay while statements.

This commit is contained in:
whitequark 2015-12-18 21:14:40 +08:00
parent 2759310662
commit 0755aa38ff
2 changed files with 6 additions and 1 deletions

View File

@ -200,11 +200,15 @@ class IODelayEstimator(algorithm.Visitor):
self.abort("{} cannot be interleaved".format(kind), node.loc) self.abort("{} cannot be interleaved".format(kind), node.loc)
self.current_delay = old_delay self.current_delay = old_delay
visit_While = lambda self, node: self.visit_control_flow("while statement", node)
visit_If = lambda self, node: self.visit_control_flow("if statement", node) visit_If = lambda self, node: self.visit_control_flow("if statement", node)
visit_IfExpT = lambda self, node: self.visit_control_flow("if expression", node) visit_IfExpT = lambda self, node: self.visit_control_flow("if expression", node)
visit_Try = lambda self, node: self.visit_control_flow("try statement", node) visit_Try = lambda self, node: self.visit_control_flow("try statement", node)
def visit_While(self, node):
old_goto, self.current_goto = self.current_goto, None
self.visit_control_flow("while statement", node)
self.current_goto = old_goto
def visit_Return(self, node): def visit_Return(self, node):
self.current_return = node self.current_return = node

View File

@ -9,6 +9,7 @@ def f():
print(2) print(2)
while False: while False:
print(3) print(3)
break
delay_mu(1) delay_mu(1)
print(4) print(4)