transforms.iodelay_estimator: correctly handle functions with empty body.

This commit is contained in:
whitequark 2015-11-24 00:46:26 +08:00
parent e53f26dba0
commit 9bc62fa3d2
2 changed files with 3 additions and 1 deletions

View File

@ -208,6 +208,7 @@ class Max(Expr):
def __init__(self, operands):
assert isinstance(operands, list)
assert all([isinstance(operand, Expr) for operand in operands])
assert operands != []
self.operands = operands
def __str__(self):

View File

@ -220,6 +220,7 @@ class IODelayEstimator(algorithm.Visitor):
delays.append(self.current_delay)
self.current_delay = old_delay
if any(delays):
self.current_delay += iodelay.Max(delays)
except _IndeterminateDelay as error:
# Interleave failures inside `with` statements are hard failures,