Changed pullUp to pull up channel arrays that have direction specifiers applied to the whole array

For example, a call like foo(6, cs!) will have cs! pulled up, iff cs was of type CHAN X.  If cs was of type CHAN! X, nothing is done (and the needless direction will be removed later on).
This commit is contained in:
Neil Brown 2009-01-20 17:33:24 +00:00
parent a416f7dac9
commit 766cb09dcf

View File

@ -382,6 +382,15 @@ pullUp pullUpArraysInsideRecords = pass "Pull up definitions"
isSlice (A.SubscriptFrom {}) = True
isSlice (A.SubscriptFor {}) = True
isSlice _ = False
doVariable v@(A.DirectedVariable m dir innerV)
= do t <- astTypeOf innerV
case t of
A.Array ds (A.Chan attr innerT) ->
do spec@(A.Specification _ n _) <- makeNonceIs "dir_array" m
(A.Array ds $ A.ChanEnd dir attr innerT) A.Abbrev v
addPulled $ (m, Left spec)
return $ A.Variable m n
_ -> descend v
doVariable v = descend v