| 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 "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 Loading... |
| 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 |
| OLD | NEW |