From 68161bdfea7c27f64fa36d09f03f9f5683d8a9ef Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sun, 22 Mar 2009 15:00:08 +0000 Subject: [PATCH] Fixed one of the occam passes so that it no longer enforces that mobile array dimensions are statically known --- frontends/OccamPasses.hs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/frontends/OccamPasses.hs b/frontends/OccamPasses.hs index 8f5ada4..8d193a1 100644 --- a/frontends/OccamPasses.hs +++ b/frontends/OccamPasses.hs @@ -129,8 +129,20 @@ checkConstants :: Pass checkConstants = occamOnlyPass "Check mandatory constants" [Prop.constantsFolded, Prop.arrayConstructorTypesDone] [Prop.constantsChecked] - (applyDepthM2 doDimension doOption) + recurse where + ops = baseOp `extOp` doType `extOp` doOption + + descend, recurse :: Data a => a -> PassM a + descend = makeDescend ops + recurse = makeRecurse ops + + doType :: A.Type -> PassM A.Type + -- Avoid checking that mobile dimensions are constant: + doType t@(A.Mobile {}) = return t + doType (A.Array ds t) = liftM2 A.Array (mapM doDimension ds) (recurse t) + doType t = descend t + -- Check array dimensions are constant. doDimension :: A.Dimension -> PassM A.Dimension doDimension d@(A.Dimension e)