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/functions.h" | 5 #include "tools/gn/functions.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <iostream> | 8 #include <iostream> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 " values = invoker.values\n" | 457 " values = invoker.values\n" |
458 " } else {\n" | 458 " } else {\n" |
459 " values = \"some default value\"\n" | 459 " values = \"some default value\"\n" |
460 " }\n" | 460 " }\n" |
461 " }\n"; | 461 " }\n"; |
462 | 462 |
463 Value RunDefined(Scope* scope, | 463 Value RunDefined(Scope* scope, |
464 const FunctionCallNode* function, | 464 const FunctionCallNode* function, |
465 const ListNode* args_list, | 465 const ListNode* args_list, |
466 Err* err) { | 466 Err* err) { |
467 const std::vector<const ParseNode*>& args_vector = args_list->contents(); | 467 const auto& args_vector = args_list->contents(); |
468 if (args_vector.size() != 1) { | 468 if (args_vector.size() != 1) { |
469 *err = Err(function, "Wrong number of arguments to defined().", | 469 *err = Err(function, "Wrong number of arguments to defined().", |
470 "Expecting exactly one."); | 470 "Expecting exactly one."); |
471 return Value(); | 471 return Value(); |
472 } | 472 } |
473 | 473 |
474 const IdentifierNode* identifier = args_vector[0]->AsIdentifier(); | 474 const IdentifierNode* identifier = args_vector[0]->AsIdentifier(); |
475 if (identifier) { | 475 if (identifier) { |
476 // Passed an identifier "defined(foo)". | 476 // Passed an identifier "defined(foo)". |
477 if (scope->GetValue(identifier->value().value())) | 477 if (scope->GetValue(identifier->value().value())) |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 } | 921 } |
922 | 922 |
923 // Otherwise it's a no-block function. | 923 // Otherwise it's a no-block function. |
924 if (!VerifyNoBlockForFunctionCall(function, block, err)) | 924 if (!VerifyNoBlockForFunctionCall(function, block, err)) |
925 return Value(); | 925 return Value(); |
926 return found_function->second.no_block_runner(scope, function, | 926 return found_function->second.no_block_runner(scope, function, |
927 args.list_value(), err); | 927 args.list_value(), err); |
928 } | 928 } |
929 | 929 |
930 } // namespace functions | 930 } // namespace functions |
OLD | NEW |