mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 21:41:34 -07:00
Count CFEExit as control flow for the purposes of finding dominators
This commit is contained in:
parent
2842ce97b8
commit
c05380d518
1 changed files with 5 additions and 2 deletions
|
@ -192,7 +192,7 @@ buildGraph params root =
|
||||||
base
|
base
|
||||||
|
|
||||||
idToRange = M.fromList mapping
|
idToRange = M.fromList mapping
|
||||||
isRealEdge (from, to, edge) = case edge of CFEFlow -> True; _ -> False
|
isRealEdge (from, to, edge) = case edge of CFEFlow -> True; CFEExit -> True; _ -> False
|
||||||
onlyRealEdges = filter isRealEdge edges
|
onlyRealEdges = filter isRealEdge edges
|
||||||
(_, mainExit) = fromJust $ M.lookup (getId root) idToRange
|
(_, mainExit) = fromJust $ M.lookup (getId root) idToRange
|
||||||
|
|
||||||
|
@ -1301,7 +1301,10 @@ findPostDominators mainexit graph = asArray
|
||||||
reversed = grev withExitEdges
|
reversed = grev withExitEdges
|
||||||
postDoms = dom reversed mainexit
|
postDoms = dom reversed mainexit
|
||||||
(_, maxNode) = nodeRange graph
|
(_, maxNode) = nodeRange graph
|
||||||
asArray = array (0, maxNode) postDoms
|
-- Holes in the array cause "Exception: (Array.!): undefined array element" while
|
||||||
|
-- inspecting/debugging, so fill the array first and then update.
|
||||||
|
initializedArray = listArray (0, maxNode) $ repeat []
|
||||||
|
asArray = initializedArray // postDoms
|
||||||
|
|
||||||
return []
|
return []
|
||||||
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])
|
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue