From 377233b4b08683b1c4cf7f7d77162d5e1b2d6f12 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 13 Nov 2008 20:12:45 +0000 Subject: [PATCH] Switched checkUnusedVar over to use forAnyASTStruct --- checks/Check.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/checks/Check.hs b/checks/Check.hs index 1758a4d..af6df13 100644 --- a/checks/Check.hs +++ b/checks/Check.hs @@ -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) $