Made sure that dereferenced mobile arrays are pulled up

This commit is contained in:
Neil Brown 2009-04-09 17:06:07 +00:00
parent 92c92a3f65
commit 794e9ba8df

View File

@ -525,6 +525,20 @@ pullUp pullUpArraysInsideRecords = pass "Pull up definitions"
addPulled $ (m, Left spec)
return $ A.Variable m n
_ -> descend v
doVariable v@(A.DerefVariable m innerV)
= do t <- astTypeOf v
case t of
A.Array ds innerT ->
do let ds' = [case d of
A.Dimension {} -> d
A.UnknownDimension -> A.Dimension $ A.ExprVariable m $
specificDimSize i innerV
| (d, i) <- zip ds [0..]]
spec@(A.Specification _ n _) <- makeNonceIs "mob_array" m
(A.Array ds' innerT) A.Abbrev v
addPulled $ (m, Left spec)
return $ A.Variable m n
_ -> descend v
doVariable v@(A.VariableSizes m _)
= do v' <- descend v
t <- astTypeOf v'