Suggest quoting expansions in for loop globs

This commit is contained in:
Vidar Holen 2018-03-24 17:43:20 -07:00
parent c3b606c68a
commit 764b242f1b
3 changed files with 25 additions and 0 deletions

View file

@ -435,3 +435,12 @@ pseudoGlobIsSuperSetof = matchable
wordsCanBeEqual x y = fromMaybe True $
liftM2 pseudoGlobsCanOverlap (wordToPseudoGlob x) (wordToPseudoGlob y)
-- Is this an expansion that can be quoted,
-- e.g. $(foo) `foo` $foo (but not {foo,})?
isQuoteableExpansion t = case t of
T_DollarExpansion {} -> True
T_DollarBraceCommandExpansion {} -> True
T_Backticked {} -> True
T_DollarBraced {} -> True
_ -> False