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

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

Issue 1884503003: GN: Replace vector<ParseNode*> with vector<unique_ptr<ParseNode>> in parse_tree.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove comments Created 4 years, 8 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_forward_variables_from.cc ('k') | tools/gn/parse_tree.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/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
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
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
OLDNEW
« no previous file with comments | « tools/gn/function_forward_variables_from.cc ('k') | tools/gn/parse_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698