mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-16 10:03:08 -07:00
When reparsing array indices, do it recursively
This commit is contained in:
parent
f1bdda54cb
commit
363c0633e0
2 changed files with 6 additions and 4 deletions
|
@ -3463,9 +3463,9 @@ notesForContext list = zipWith ($) [first, second] $ filter isName list
|
|||
|
||||
-- Go over all T_UnparsedIndex and reparse them as either arithmetic or text
|
||||
-- depending on declare -A statements.
|
||||
reparseIndices root =
|
||||
analyze blank blank f root
|
||||
reparseIndices root = process root
|
||||
where
|
||||
process = analyze blank blank f
|
||||
associative = getAssociativeArrays root
|
||||
isAssociative s = s `elem` associative
|
||||
f (T_Assignment id mode name indices value) = do
|
||||
|
@ -3490,8 +3490,9 @@ reparseIndices root =
|
|||
|
||||
fixAssignmentIndex name word =
|
||||
case word of
|
||||
T_UnparsedIndex id pos src ->
|
||||
parsed name pos src
|
||||
T_UnparsedIndex id pos src -> do
|
||||
idx <- parsed name pos src
|
||||
process idx -- Recursively parse for cases like x[y[z=1]]=1
|
||||
_ -> return word
|
||||
|
||||
parsed name pos src =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue