Include inherited env for DFA of leftover functions (fixes #2560)
This commit is contained in:
parent
4806719035
commit
fcc473e27f
|
@ -2099,6 +2099,8 @@ prop_checkSpacefulnessCfg61 = verify checkSpacefulnessCfg "declare -x X; y=foo$X
|
||||||
prop_checkSpacefulnessCfg62 = verifyNot checkSpacefulnessCfg "f() { declare -x X; y=foo$X; echo $y; }"
|
prop_checkSpacefulnessCfg62 = verifyNot checkSpacefulnessCfg "f() { declare -x X; y=foo$X; echo $y; }"
|
||||||
prop_checkSpacefulnessCfg63 = verify checkSpacefulnessCfg "f && declare -i s; s='x + y'; echo $s"
|
prop_checkSpacefulnessCfg63 = verify checkSpacefulnessCfg "f && declare -i s; s='x + y'; echo $s"
|
||||||
prop_checkSpacefulnessCfg64 = verifyNot checkSpacefulnessCfg "declare -i s; s='x + y'; x=$s; echo $x"
|
prop_checkSpacefulnessCfg64 = verifyNot checkSpacefulnessCfg "declare -i s; s='x + y'; x=$s; echo $x"
|
||||||
|
prop_checkSpacefulnessCfg65 = verifyNot checkSpacefulnessCfg "f() { s=$?; echo $s; }; f"
|
||||||
|
prop_checkSpacefulnessCfg66 = verifyNot checkSpacefulnessCfg "f() { s=$?; echo $s; }"
|
||||||
|
|
||||||
checkSpacefulnessCfg = checkSpacefulnessCfg' True
|
checkSpacefulnessCfg = checkSpacefulnessCfg' True
|
||||||
checkVerboseSpacefulnessCfg = checkSpacefulnessCfg' False
|
checkVerboseSpacefulnessCfg = checkSpacefulnessCfg' False
|
||||||
|
|
|
@ -1300,8 +1300,7 @@ dataflow ctx entry = do
|
||||||
outgoing = map snd outgoingL
|
outgoing = map snd outgoingL
|
||||||
isRegular = ((== CFEFlow) . fst)
|
isRegular = ((== CFEFlow) . fst)
|
||||||
|
|
||||||
runRoot ctx entry exit = do
|
runRoot ctx env entry exit = do
|
||||||
let env = createEnvironmentState
|
|
||||||
writeSTRef (cInput ctx) $ env
|
writeSTRef (cInput ctx) $ env
|
||||||
writeSTRef (cOutput ctx) $ env
|
writeSTRef (cOutput ctx) $ env
|
||||||
writeSTRef (cNode ctx) $ entry
|
writeSTRef (cNode ctx) $ entry
|
||||||
|
@ -1321,9 +1320,10 @@ analyzeControlFlow params t =
|
||||||
runST $ f cfg entry exit
|
runST $ f cfg entry exit
|
||||||
where
|
where
|
||||||
f cfg entry exit = do
|
f cfg entry exit = do
|
||||||
|
let env = createEnvironmentState
|
||||||
ctx <- newCtx $ cfGraph cfg
|
ctx <- newCtx $ cfGraph cfg
|
||||||
-- Do a dataflow analysis starting on the root node
|
-- Do a dataflow analysis starting on the root node
|
||||||
exitState <- runRoot ctx entry exit
|
exitState <- runRoot ctx env entry exit
|
||||||
|
|
||||||
-- All nodes we've touched
|
-- All nodes we've touched
|
||||||
invocations <- readSTRef $ cInvocations ctx
|
invocations <- readSTRef $ cInvocations ctx
|
||||||
|
@ -1336,7 +1336,7 @@ analyzeControlFlow params t =
|
||||||
let uninvoked = M.difference declaredFunctions invokedNodes
|
let uninvoked = M.difference declaredFunctions invokedNodes
|
||||||
|
|
||||||
let stragglerInput =
|
let stragglerInput =
|
||||||
exitState {
|
(env `patchState` exitState) {
|
||||||
-- We don't want `die() { exit $?; }; echo "Sourced"` to assume $? is always echo
|
-- We don't want `die() { exit $?; }; echo "Sourced"` to assume $? is always echo
|
||||||
sExitCodes = Nothing
|
sExitCodes = Nothing
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue