Corrected a bug in varsTouchedAfter that was related to flowAlgorithm and was causing the odd bug in checkUnusedVar
This commit is contained in:
parent
be6c57ce5b
commit
ae7557d623
|
@ -410,13 +410,13 @@ varsTouchedAfter = FlowGraphAnalysis
|
||||||
|
|
||||||
iterate :: FlowGraph CheckOptM UsageLabel ->
|
iterate :: FlowGraph CheckOptM UsageLabel ->
|
||||||
(Node, EdgeLabel) -> Set.Set Var -> Maybe (Set.Set Var) -> Set.Set Var
|
(Node, EdgeLabel) -> Set.Set Var -> Maybe (Set.Set Var) -> Set.Set Var
|
||||||
iterate g node prevVars maybeVars = case lab g (fst node) of
|
iterate g node varsForPrevNode maybeVars = case lab g (fst node) of
|
||||||
Just ul ->
|
Just ul ->
|
||||||
let vs = nodeVars $ getNodeData ul
|
let vs = nodeVars $ getNodeData ul
|
||||||
readFromVars = readVars vs
|
readFromVars = readVars vs
|
||||||
writtenToVars = writtenVars vs
|
writtenToVars = writtenVars vs
|
||||||
addTo = fromMaybe prevVars maybeVars
|
addTo = fromMaybe Set.empty maybeVars
|
||||||
in (readFromVars `Set.union` addTo) `Set.union` Map.keysSet writtenToVars
|
in foldl Set.union addTo [varsForPrevNode, readFromVars, Map.keysSet writtenToVars]
|
||||||
Nothing -> error "Node label not found in calculateUsedAgainAfter"
|
Nothing -> error "Node label not found in calculateUsedAgainAfter"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user