mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-08 11:14:25 +08:00
Simplify functionMap and remove unnecessary partiality
This commit is contained in:
@@ -2825,13 +2825,11 @@ checkUnpassedInFunctions params root =
|
|||||||
execWriter $ mapM_ warnForGroup referenceGroups
|
execWriter $ mapM_ warnForGroup referenceGroups
|
||||||
where
|
where
|
||||||
functionMap :: Map.Map String Token
|
functionMap :: Map.Map String Token
|
||||||
functionMap = Map.fromList $
|
functionMap = Map.fromList $ execWriter $ doAnalysis (tell . maybeToList . findFunction) root
|
||||||
map (\t@(T_Function _ _ _ name _) -> (name,t)) functions
|
|
||||||
functions = execWriter $ doAnalysis (tell . maybeToList . findFunction) root
|
|
||||||
|
|
||||||
findFunction t@(T_Function id _ _ name body)
|
findFunction t@(T_Function id _ _ name body)
|
||||||
| any (isPositionalReference t) flow && not (any isPositionalAssignment flow)
|
| any (isPositionalReference t) flow && not (any isPositionalAssignment flow)
|
||||||
= return t
|
= return (name,t)
|
||||||
where flow = getVariableFlow params body
|
where flow = getVariableFlow params body
|
||||||
findFunction _ = Nothing
|
findFunction _ = Nothing
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user