From 17255bb2b18d2c516281c88b09a40907ae4497bd Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 5 Jun 2008 20:22:47 +0000 Subject: [PATCH] Changed the uses of flowAlgorithm to make better use of userErrLabel to give better error messages --- checks/Check.hs | 2 +- checks/UsageCheckAlgorithms.hs | 2 +- flow/FlowAlgorithms.hs | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/checks/Check.hs b/checks/Check.hs index 76ee62d..7bdf267 100644 --- a/checks/Check.hs +++ b/checks/Check.hs @@ -181,7 +181,7 @@ checkInitVar m graph startNode ,nodesToProcess = lpre graph ,nodesToReAdd = lsuc graph ,defVal = Everything - ,userErrLabel = show + ,userErrLabel = ("for node at: " ++) . show . fmap getNodeMeta . lab graph } getMeta :: Node -> Meta diff --git a/checks/UsageCheckAlgorithms.hs b/checks/UsageCheckAlgorithms.hs index 6699b7b..3fb18e1 100644 --- a/checks/UsageCheckAlgorithms.hs +++ b/checks/UsageCheckAlgorithms.hs @@ -141,7 +141,7 @@ findReachDef graph startNode ,nodesToProcess = lpre graph ,nodesToReAdd = lsuc graph ,defVal = Map.empty - ,userErrLabel = show + ,userErrLabel = ("for node at: " ++) . show . fmap getNodeMeta . lab graph } readInNode' :: Node -> Var -> a -> Bool diff --git a/flow/FlowAlgorithms.hs b/flow/FlowAlgorithms.hs index 3d5a0c6..296c5d4 100644 --- a/flow/FlowAlgorithms.hs +++ b/flow/FlowAlgorithms.hs @@ -129,9 +129,10 @@ flowAlgorithm funcs nodes (startNode, startVal) -- Pick the next node from the list and remove it: = do let (node, workList') = Set.deleteFindMin workList -- Process that node: - total <- foldWithEither (iterateNode vals) (Left $ show workList - ++ userErrLabel - funcs node) (nodesToProcess funcs node) + total <- foldWithEither (iterateNode vals) (Left $ + "Nodes still to process: " ++ show workList + ++ " " ++ userErrLabel funcs node) + (nodesToProcess funcs node) nodeVal <- Map.lookup node vals if total /= nodeVal -- If the value has changed, that will cascade to affect all