mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-06 21:11:35 -07:00
Warn when calling functions before defining them.
This commit is contained in:
parent
43bb6a20ad
commit
81388cefd2
2 changed files with 35 additions and 1 deletions
|
@ -308,6 +308,7 @@ isBraceExpansion t = case t of T_BraceExpansion {} -> True; _ -> False
|
|||
|
||||
-- Get the lists of commands from tokens that contain them, such as
|
||||
-- the body of while loops or branches of if statements.
|
||||
getCommandSequences :: Token -> [[Token]]
|
||||
getCommandSequences t =
|
||||
case t of
|
||||
T_Script _ _ cmds -> [cmds]
|
||||
|
@ -318,6 +319,7 @@ getCommandSequences t =
|
|||
T_ForIn _ _ _ cmds -> [cmds]
|
||||
T_ForArithmetic _ _ _ _ cmds -> [cmds]
|
||||
T_IfExpression _ thens elses -> map snd thens ++ [elses]
|
||||
T_Annotation _ _ t -> getCommandSequences t
|
||||
_ -> []
|
||||
|
||||
-- Get a list of names of associative arrays
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue