Fixed channel arrays in PROC parameters to be pulled up

This commit is contained in:
Neil Brown 2009-03-25 18:26:33 +00:00
parent fd7de709c0
commit 127a72ad5e

View File

@ -322,12 +322,29 @@ pullUp pullUpArraysInsideRecords = pass "Pull up definitions"
popPullContext popPullContext
return s' return s'
doProcActual :: Transform A.Actual
doProcActual a@(A.ActualVariable {}) = return a
doProcActual a@(A.ActualExpression {}) = return a
-- Definitely pull up channel arrays and claims:
doProcActual a
= do a' <- recurse a
t <- astTypeOf a
spec@(A.Specification _ n' _)
<- defineNonce m "actual" (A.Is m A.Abbrev t a) A.Abbrev
addPulled (m, Left spec)
return $ A.ActualVariable (A.Variable m n')
where
m = findMeta a
-- | As with doStructured: when we find a process, create a new pulled items -- | As with doStructured: when we find a process, create a new pulled items
-- context, and if we find any items apply them to it. -- context, and if we find any items apply them to it.
doProcess :: A.Process -> PassM A.Process doProcess :: A.Process -> PassM A.Process
doProcess p doProcess p
= do pushPullContext = do pushPullContext
p' <- descend p p' <- case p of
A.ProcCall m n as
-> mapM doProcActual as >>* A.ProcCall m n
_ -> descend p
pulled <- havePulled pulled <- havePulled
p'' <- if pulled p'' <- if pulled
then liftM (A.Seq emptyMeta) $ applyPulled (A.Only emptyMeta p') then liftM (A.Seq emptyMeta) $ applyPulled (A.Only emptyMeta p')