| Index: tools/gn/substitution_type.cc
|
| diff --git a/tools/gn/substitution_type.cc b/tools/gn/substitution_type.cc
|
| index c6ea38597dd44c2118e9f5aa45bbc2e382b933eb..99b4e6802df7b49a250dffd4e812878b3ba69b6d 100644
|
| --- a/tools/gn/substitution_type.cc
|
| +++ b/tools/gn/substitution_type.cc
|
| @@ -166,6 +166,11 @@ bool IsValidSourceSubstitution(SubstitutionType type) {
|
| type == SUBSTITUTION_SOURCE_TARGET_RELATIVE;
|
| }
|
|
|
| +bool IsValidScriptArgsSubstitution(SubstitutionType type) {
|
| + return IsValidSourceSubstitution(type) ||
|
| + type == SUBSTITUTION_RSP_FILE_NAME;
|
| +}
|
| +
|
| bool IsValidToolSubstitution(SubstitutionType type) {
|
| return type == SUBSTITUTION_LITERAL ||
|
| type == SUBSTITUTION_OUTPUT ||
|
| @@ -236,14 +241,14 @@ bool IsValidCompileXCassetsSubstitution(SubstitutionType type) {
|
| type == SUBSTITUTION_BUNDLE_PRODUCT_TYPE;
|
| }
|
|
|
| -bool EnsureValidSourcesSubstitutions(
|
| - const std::vector<SubstitutionType>& types,
|
| - const ParseNode* origin,
|
| - Err* err) {
|
| - for (size_t i = 0; i < types.size(); i++) {
|
| - if (!IsValidSourceSubstitution(types[i])) {
|
| +bool EnsureValidSubstitutions(const std::vector<SubstitutionType>& types,
|
| + bool (*is_valid_subst)(SubstitutionType),
|
| + const ParseNode* origin,
|
| + Err* err) {
|
| + for (SubstitutionType type : types) {
|
| + if (!is_valid_subst(type)) {
|
| *err = Err(origin, "Invalid substitution type.",
|
| - "The substitution " + std::string(kSubstitutionNames[types[i]]) +
|
| + "The substitution " + std::string(kSubstitutionNames[type]) +
|
| " isn't valid for something\n"
|
| "operating on a source file such as this.");
|
| return false;
|
|
|