Fixed a couple of problems with the usage checking

This commit is contained in:
Neil Brown 2009-02-10 12:40:24 +00:00
parent 68f808583b
commit bcd670bfd2
2 changed files with 8 additions and 3 deletions

View File

@ -314,8 +314,13 @@ checkPlainVarUsage sharedAttr (m, p) = check p
splitEnds :: (Var, a) -> m [(Var, a)]
splitEnds (Var v, x)
= do t <- astTypeOf v
case t of
A.Chan {} -> return
case (t, v) of
-- Push the direction up to the array, not outside:
(A.Chan {}, A.SubscriptedVariable m sub v')
-> return [(Var $ A.SubscriptedVariable m sub $
A.DirectedVariable m dir v', x)
| dir <- [A.DirInput, A.DirOutput]]
(A.Chan {}, _) -> return
[(Var $ A.DirectedVariable (findMeta v) dir v, x)
| dir <- [A.DirInput, A.DirOutput]]
_ -> return [(Var v, x)]

View File

@ -204,7 +204,7 @@ abbrevCheckPass
return s
doStructured s@(A.Spec _ (A.Specification m n (A.IsExpr _ A.ValAbbrev _ e)) scope)
= do checkNotWritten (A.Variable m n) scope "VAL-abbreviated variable % written-to inside the scope of the abbreviation"
sequence_ [checkAbbreved v scope
sequence_ [checkNotWritten v scope
"Abbreviated variable % used inside the scope of the abbreviation"
| A.ExprVariable _ v <- listify (const True) e]
return s