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

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

Issue 610293003: Replace more for loops in GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 years, 2 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/function_process_file_template.cc ('k') | tools/gn/function_toolchain.cc » ('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/build_settings.h" 5 #include "tools/gn/build_settings.h"
6 #include "tools/gn/filesystem_utils.h" 6 #include "tools/gn/filesystem_utils.h"
7 #include "tools/gn/functions.h" 7 #include "tools/gn/functions.h"
8 #include "tools/gn/parse_tree.h" 8 #include "tools/gn/parse_tree.h"
9 #include "tools/gn/scope.h" 9 #include "tools/gn/scope.h"
10 #include "tools/gn/settings.h" 10 #include "tools/gn/settings.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 // Path conversion. 254 // Path conversion.
255 if (inputs.type() == Value::STRING) { 255 if (inputs.type() == Value::STRING) {
256 return ConvertOnePath(scope, function, inputs, 256 return ConvertOnePath(scope, function, inputs,
257 from_dir, to_dir, convert_to_system_absolute, err); 257 from_dir, to_dir, convert_to_system_absolute, err);
258 258
259 } else if (inputs.type() == Value::LIST) { 259 } else if (inputs.type() == Value::LIST) {
260 result = Value(function, Value::LIST); 260 result = Value(function, Value::LIST);
261 result.list_value().reserve(inputs.list_value().size()); 261 result.list_value().reserve(inputs.list_value().size());
262 262
263 for (size_t i = 0; i < inputs.list_value().size(); i++) { 263 for (const auto& input : inputs.list_value()) {
264 result.list_value().push_back( 264 result.list_value().push_back(
265 ConvertOnePath(scope, function, inputs.list_value()[i], 265 ConvertOnePath(scope, function, input,
266 from_dir, to_dir, convert_to_system_absolute, err)); 266 from_dir, to_dir, convert_to_system_absolute, err));
267 if (err->has_error()) { 267 if (err->has_error()) {
268 result = Value(); 268 result = Value();
269 return result; 269 return result;
270 } 270 }
271 } 271 }
272 return result; 272 return result;
273 } 273 }
274 274
275 *err = Err(function->function(), 275 *err = Err(function->function(),
276 "rebase_path requires a list or a string."); 276 "rebase_path requires a list or a string.");
277 return result; 277 return result;
278 } 278 }
279 279
280 } // namespace functions 280 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/function_process_file_template.cc ('k') | tools/gn/function_toolchain.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698