Skip to content

Commit

Permalink
Simplify functionMap and remove unnecessary partiality
Browse files Browse the repository at this point in the history
  • Loading branch information
josephcsible committed Dec 21, 2023
1 parent bfe4342 commit f983d9a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/ShellCheck/Analytics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2825,13 +2825,11 @@ checkUnpassedInFunctions params root =
execWriter $ mapM_ warnForGroup referenceGroups
where
functionMap :: Map.Map String Token
functionMap = Map.fromList $
map (\t@(T_Function _ _ _ name _) -> (name,t)) functions
functions = execWriter $ doAnalysis (tell . maybeToList . findFunction) root
functionMap = Map.fromList $ execWriter $ doAnalysis (tell . maybeToList . findFunction) root

findFunction t@(T_Function id _ _ name body)
| any (isPositionalReference t) flow && not (any isPositionalAssignment flow)
= return t
= return (name,t)
where flow = getVariableFlow params body
findFunction _ = Nothing

Expand Down

0 comments on commit f983d9a

Please sign in to comment.