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

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

Issue 2936923002: Add not_needed function (Closed)
Patch Set: Rename to not_needed Created 3 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/err.h" 5 #include "tools/gn/err.h"
6 #include "tools/gn/functions.h" 6 #include "tools/gn/functions.h"
7 #include "tools/gn/parse_tree.h" 7 #include "tools/gn/parse_tree.h"
8 #include "tools/gn/scope.h" 8 #include "tools/gn/scope.h"
9 9
10 namespace functions { 10 namespace functions {
11 11
12 namespace { 12 namespace {
13 13
14 void ForwardAllValues(const FunctionCallNode* function, 14 void ForwardAllValues(const FunctionCallNode* function,
15 Scope* source, 15 Scope* source,
16 Scope* dest, 16 Scope* dest,
17 const std::set<std::string>& exclusion_set, 17 const std::set<std::string>& exclusion_set,
18 Err* err) { 18 Err* err) {
19 Scope::MergeOptions options; 19 Scope::MergeOptions options;
20 // This function needs to clobber existing for it to be useful. It will be 20 // This function needs to clobber existing for it to be useful. It will be
21 // called in a template to forward all values, but there will be some 21 // called in a template to forward all values, but there will be some
22 // default stuff like configs set up in both scopes, so it would always 22 // default stuff like configs set up in both scopes, so it would always
23 // fail if it didn't clobber. 23 // fail if it didn't clobber.
24 options.clobber_existing = true; 24 options.clobber_existing = true;
25 options.skip_private_vars = true; 25 options.skip_private_vars = true;
26 options.mark_dest_used = false; 26 options.mark_dest_used = false;
27 options.excluded_values = exclusion_set; 27 options.excluded_values = exclusion_set;
28 source->NonRecursiveMergeTo(dest, options, function, 28 source->NonRecursiveMergeTo(dest, options, function,
29 "source scope", err); 29 "source scope", err);
30 source->MarkAllUsed(); 30 source->MarkAllUsed(err);
31 } 31 }
32 32
33 void ForwardValuesFromList(Scope* source, 33 void ForwardValuesFromList(Scope* source,
34 Scope* dest, 34 Scope* dest,
35 const std::vector<Value>& list, 35 const std::vector<Value>& list,
36 const std::set<std::string>& exclusion_set, 36 const std::set<std::string>& exclusion_set,
37 Err* err) { 37 Err* err) {
38 for (const Value& cur : list) { 38 for (const Value& cur : list) {
39 if (!cur.VerifyTypeIs(Value::STRING, err)) 39 if (!cur.VerifyTypeIs(Value::STRING, err))
40 return; 40 return;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 233 }
234 } 234 }
235 235
236 // Not the right type of argument. 236 // Not the right type of argument.
237 *err = Err(what_value, "Not a valid list of variables to copy.", 237 *err = Err(what_value, "Not a valid list of variables to copy.",
238 "Expecting either the string \"*\" or a list of strings."); 238 "Expecting either the string \"*\" or a list of strings.");
239 return Value(); 239 return Value();
240 } 240 }
241 241
242 } // namespace functions 242 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/function_template.cc » ('j') | tools/gn/functions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698