Avoid defining flags for non-literal parameters
This commit is contained in:
parent
561075ea79
commit
3e3e4fd0cd
|
@ -2087,6 +2087,7 @@ prop_checkUnused40= verifyNotTree checkUnusedAssignments "arr=(1 2); num=2; echo
|
|||
prop_checkUnused41= verifyNotTree checkUnusedAssignments "@test 'foo' {\ntrue\n}\n"
|
||||
prop_checkUnused42= verifyNotTree checkUnusedAssignments "DEFINE_string foo '' ''; echo \"${FLAGS_foo}\""
|
||||
prop_checkUnused43= verifyTree checkUnusedAssignments "DEFINE_string foo '' ''"
|
||||
prop_checkUnused44= verifyNotTree checkUnusedAssignments "DEFINE_string \"foo$ibar\" x y"
|
||||
checkUnusedAssignments params t = execWriter (mapM_ warnFor unused)
|
||||
where
|
||||
flow = variableFlow params
|
||||
|
|
|
@ -685,10 +685,10 @@ getModifiedVariableCommand base@(T_SimpleCommand _ _ (T_NormalWord _ (T_Literal
|
|||
(filter (\(x,_) -> getLiteralString x == Just "-a") (zip (args) (tail args)))
|
||||
|
||||
-- get the FLAGS_ variable created by a shflags DEFINE_ call
|
||||
getFlagVariable (n:v:_) = return (base, n, flagName n, DataString $ SourceFrom [v])
|
||||
where
|
||||
flagName varName@(T_NormalWord _ _) = "FLAGS_" ++ (onlyLiteralString varName)
|
||||
getFlagVariable _ = fail "Invalid flag definition"
|
||||
getFlagVariable (n:v:_) = do
|
||||
name <- getLiteralString v
|
||||
return (base, n, "FLAGS_" ++ name, DataString $ SourceExternal)
|
||||
getFlagVariable _ = Nothing
|
||||
|
||||
getModifiedVariableCommand _ = []
|
||||
|
||||
|
|
Loading…
Reference in New Issue