mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-11 15:46:26 -07:00
Count b as a reference in ${a:b}
This commit is contained in:
parent
5a46eeb09a
commit
a90b6d14b3
2 changed files with 11 additions and 1 deletions
|
@ -474,11 +474,20 @@ getIndexReferences s = fromMaybe [] $ do
|
|||
where
|
||||
re = mkRegex "(\\[.*\\])"
|
||||
|
||||
getOffsetReferences mods = fromMaybe [] $ do
|
||||
match <- matchRegex re mods
|
||||
offsets <- match !!! 0
|
||||
return $ matchAllStrings variableNameRegex offsets
|
||||
where
|
||||
re = mkRegex "^ *:(.*)"
|
||||
|
||||
getReferencedVariables parents t =
|
||||
case t of
|
||||
T_DollarBraced id l -> let str = bracedString t in
|
||||
(t, t, getBracedReference str) :
|
||||
map (\x -> (l, l, x)) (getIndexReferences str)
|
||||
map (\x -> (l, l, x)) (
|
||||
getIndexReferences str
|
||||
++ getOffsetReferences (getBracedModifier str))
|
||||
TA_Expansion id _ ->
|
||||
if isArithmeticAssignment t
|
||||
then []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue