SC2324: Warn when x+=1 appends.

This commit is contained in:
Vidar Holen 2023-07-30 13:47:00 -07:00
parent c9e27c2470
commit 372c0b667e
4 changed files with 64 additions and 0 deletions

View file

@ -886,6 +886,15 @@ isUnmodifiedParameterExpansion t =
in getBracedReference str == str
_ -> False
-- Return the referenced variable if (and only if) it's an unmodified parameter expansion.
getUnmodifiedParameterExpansion t =
case t of
T_DollarBraced _ _ list -> do
let str = concat $ oversimplify list
guard $ getBracedReference str == str
return str
_ -> Nothing
--- A list of the element and all its parents up to the root node.
getPath tree t = t :
case Map.lookup (getId t) tree of