Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: tools/gn/value_extractors.cc

Issue 1621053002: Add an assert_no_deps variable to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fix Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/value_extractors.h ('k') | tools/gn/variables.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "tools/gn/value_extractors.h" 5 #include "tools/gn/value_extractors.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "tools/gn/build_settings.h" 9 #include "tools/gn/build_settings.h"
10 #include "tools/gn/err.h" 10 #include "tools/gn/err.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (!v.VerifyTypeIs(Value::STRING, err)) 137 if (!v.VerifyTypeIs(Value::STRING, err))
138 return false; 138 return false;
139 out->label = Label::Resolve(current_dir, current_toolchain, v, err); 139 out->label = Label::Resolve(current_dir, current_toolchain, v, err);
140 out->origin = v.origin(); 140 out->origin = v.origin();
141 return !err->has_error(); 141 return !err->has_error();
142 } 142 }
143 const SourceDir& current_dir; 143 const SourceDir& current_dir;
144 const Label& current_toolchain; 144 const Label& current_toolchain;
145 }; 145 };
146 146
147 struct LabelPatternResolver {
148 LabelPatternResolver(const SourceDir& current_dir_in)
149 : current_dir(current_dir_in) {
150 }
151 bool operator()(const Value& v, LabelPattern* out, Err* err) const {
152 *out = LabelPattern::GetPattern(current_dir, v, err);
153 return !err->has_error();
154 }
155 const SourceDir& current_dir;
156 };
157
147 } // namespace 158 } // namespace
148 159
149 bool ExtractListOfStringValues(const Value& value, 160 bool ExtractListOfStringValues(const Value& value,
150 std::vector<std::string>* dest, 161 std::vector<std::string>* dest,
151 Err* err) { 162 Err* err) {
152 if (!value.VerifyTypeIs(Value::LIST, err)) 163 if (!value.VerifyTypeIs(Value::LIST, err))
153 return false; 164 return false;
154 const std::vector<Value>& input_list = value.list_value(); 165 const std::vector<Value>& input_list = value.list_value();
155 dest->reserve(input_list.size()); 166 dest->reserve(input_list.size());
156 for (const auto& item : input_list) { 167 for (const auto& item : input_list) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 240 }
230 241
231 bool ExtractRelativeFile(const BuildSettings* build_settings, 242 bool ExtractRelativeFile(const BuildSettings* build_settings,
232 const Value& value, 243 const Value& value,
233 const SourceDir& current_dir, 244 const SourceDir& current_dir,
234 SourceFile* file, 245 SourceFile* file,
235 Err* err) { 246 Err* err) {
236 RelativeFileConverter converter(build_settings, current_dir); 247 RelativeFileConverter converter(build_settings, current_dir);
237 return converter(value, file, err); 248 return converter(value, file, err);
238 } 249 }
250
251 bool ExtractListOfLabelPatterns(const Value& value,
252 const SourceDir& current_dir,
253 std::vector<LabelPattern>* patterns,
254 Err* err) {
255 return ListValueExtractor(value, patterns, err,
256 LabelPatternResolver(current_dir));
257 }
OLDNEW
« no previous file with comments | « tools/gn/value_extractors.h ('k') | tools/gn/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698