OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/stl_util.h" | |
5 #include "tools/gn/functions.h" | 6 #include "tools/gn/functions.h" |
6 #include "tools/gn/parse_tree.h" | 7 #include "tools/gn/parse_tree.h" |
7 #include "tools/gn/scope.h" | 8 #include "tools/gn/scope.h" |
8 #include "tools/gn/settings.h" | 9 #include "tools/gn/settings.h" |
9 #include "tools/gn/substitution_list.h" | 10 #include "tools/gn/substitution_list.h" |
10 #include "tools/gn/substitution_writer.h" | 11 #include "tools/gn/substitution_writer.h" |
11 #include "tools/gn/target.h" | 12 #include "tools/gn/target.h" |
12 #include "tools/gn/value_extractors.h" | 13 #include "tools/gn/value_extractors.h" |
13 | 14 |
14 namespace functions { | 15 namespace functions { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 return Value(); | 88 return Value(); |
88 } else if (template_arg.type() == Value::LIST) { | 89 } else if (template_arg.type() == Value::LIST) { |
89 if (!subst.Parse(template_arg, err)) | 90 if (!subst.Parse(template_arg, err)) |
90 return Value(); | 91 return Value(); |
91 } else { | 92 } else { |
92 *err = Err(template_arg, "Not a string or a list."); | 93 *err = Err(template_arg, "Not a string or a list."); |
93 return Value(); | 94 return Value(); |
94 } | 95 } |
95 | 96 |
96 auto& types = subst.required_types(); | 97 auto& types = subst.required_types(); |
97 if (std::find(types.begin(), types.end(), | 98 if (base::ContainsValue(types,SUBSTITUTION_SOURCE_TARGET_RELATIVE) { |
brettw
2017/06/15 21:02:30
Space before period.
brettw
2017/06/15 21:02:44
I mean comma, sorry.
Tripta
2017/06/16 11:17:29
Have added a space after comma.
| |
98 SUBSTITUTION_SOURCE_TARGET_RELATIVE) != types.end()) { | |
99 *err = Err(template_arg, "Not a valid substitution type for the function."); | 99 *err = Err(template_arg, "Not a valid substitution type for the function."); |
100 return Value(); | 100 return Value(); |
101 } | 101 } |
102 | 102 |
103 SubstitutionWriter::ApplyListToSourcesAsString( | 103 SubstitutionWriter::ApplyListToSourcesAsString( |
104 nullptr, scope->settings(), subst, input_files, &result_files); | 104 nullptr, scope->settings(), subst, input_files, &result_files); |
105 | 105 |
106 // Convert the list of strings to the return Value. | 106 // Convert the list of strings to the return Value. |
107 Value ret(function, Value::LIST); | 107 Value ret(function, Value::LIST); |
108 ret.list_value().reserve(result_files.size()); | 108 ret.list_value().reserve(result_files.size()); |
109 for (const auto& file : result_files) | 109 for (const auto& file : result_files) |
110 ret.list_value().push_back(Value(function, file)); | 110 ret.list_value().push_back(Value(function, file)); |
111 | 111 |
112 return ret; | 112 return ret; |
113 } | 113 } |
114 | 114 |
115 } // namespace functions | 115 } // namespace functions |
OLD | NEW |