Switched checkUnusedVar over to use forAnyASTStruct

This commit is contained in:
Neil Brown 2008-11-13 20:12:45 +00:00
parent 16a2be40b4
commit 377233b4b0

View File

@ -274,11 +274,12 @@ checkProcCallArgsUsage = mapM_ checkArgs . listify isProcCall
checkPlainVarUsage (m, mockedupParItems)
checkArrayUsage (m, fmap ((,) []) mockedupParItems)
-- TODO make this work on any structured type (provide forAnyASTStruct)
checkUnusedVar :: CheckOptM ()
checkUnusedVar = forAnyAST doSpec
checkUnusedVar = forAnyASTStruct doSpec
where
doSpec (A.Spec _ (A.Specification mspec name _) scope :: A.Structured A.Process)
doSpec :: Data a => A.Structured a -> CheckOptM' (A.Structured a) ()
doSpec (A.Spec _ (A.Specification mspec name _) scope)
= do vars <- withChild [1] $ getCachedAnalysis' isScopeIn varsTouchedAfter
liftIO $ putStrLn $ "Vars: " ++ show vars
when (not $ (Var $ A.Variable emptyMeta name) `Set.member` vars) $