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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 return result; | 246 return result; |
247 from_dir = | 247 from_dir = |
248 current_dir.ResolveRelativeDir(args[kArgIndexFrom].string_value()); | 248 current_dir.ResolveRelativeDir(args[kArgIndexFrom].string_value()); |
249 } else { | 249 } else { |
250 // Default to current directory if unspecified. | 250 // Default to current directory if unspecified. |
251 from_dir = current_dir; | 251 from_dir = current_dir; |
252 } | 252 } |
253 | 253 |
254 // Path conversion. | 254 // Path conversion. |
255 if (inputs.type() == Value::STRING) { | 255 if (inputs.type() == Value::STRING) { |
256 if (inputs.string_value() == "//foo") | |
257 printf("foo\n"); | |
jamesr
2014/08/19 19:30:41
lol
| |
258 return ConvertOnePath(scope, function, inputs, | 256 return ConvertOnePath(scope, function, inputs, |
259 from_dir, to_dir, convert_to_system_absolute, err); | 257 from_dir, to_dir, convert_to_system_absolute, err); |
260 | 258 |
261 } else if (inputs.type() == Value::LIST) { | 259 } else if (inputs.type() == Value::LIST) { |
262 result = Value(function, Value::LIST); | 260 result = Value(function, Value::LIST); |
263 result.list_value().reserve(inputs.list_value().size()); | 261 result.list_value().reserve(inputs.list_value().size()); |
264 | 262 |
265 for (size_t i = 0; i < inputs.list_value().size(); i++) { | 263 for (size_t i = 0; i < inputs.list_value().size(); i++) { |
266 result.list_value().push_back( | 264 result.list_value().push_back( |
267 ConvertOnePath(scope, function, inputs.list_value()[i], | 265 ConvertOnePath(scope, function, inputs.list_value()[i], |
268 from_dir, to_dir, convert_to_system_absolute, err)); | 266 from_dir, to_dir, convert_to_system_absolute, err)); |
269 if (err->has_error()) { | 267 if (err->has_error()) { |
270 result = Value(); | 268 result = Value(); |
271 return result; | 269 return result; |
272 } | 270 } |
273 } | 271 } |
274 return result; | 272 return result; |
275 } | 273 } |
276 | 274 |
277 *err = Err(function->function(), | 275 *err = Err(function->function(), |
278 "rebase_path requires a list or a string."); | 276 "rebase_path requires a list or a string."); |
279 return result; | 277 return result; |
280 } | 278 } |
281 | 279 |
282 } // namespace functions | 280 } // namespace functions |
OLD | NEW |