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

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

Issue 1314773005: Throw errors for nested targets in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/functions.cc ('k') | tools/gn/variables.cc » ('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 "tools/gn/config_values_generator.h" 7 #include "tools/gn/config_values_generator.h"
8 #include "tools/gn/err.h" 8 #include "tools/gn/err.h"
9 #include "tools/gn/parse_tree.h" 9 #include "tools/gn/parse_tree.h"
10 #include "tools/gn/scope.h" 10 #include "tools/gn/scope.h"
(...skipping 13 matching lines...) Expand all
24 namespace functions { 24 namespace functions {
25 25
26 namespace { 26 namespace {
27 27
28 Value ExecuteGenericTarget(const char* target_type, 28 Value ExecuteGenericTarget(const char* target_type,
29 Scope* scope, 29 Scope* scope,
30 const FunctionCallNode* function, 30 const FunctionCallNode* function,
31 const std::vector<Value>& args, 31 const std::vector<Value>& args,
32 BlockNode* block, 32 BlockNode* block,
33 Err* err) { 33 Err* err) {
34 NonNestableBlock non_nestable(scope, function, "target");
35 if (!non_nestable.Enter(err))
36 return Value();
37
34 if (!EnsureNotProcessingImport(function, scope, err) || 38 if (!EnsureNotProcessingImport(function, scope, err) ||
35 !EnsureNotProcessingBuildConfig(function, scope, err)) 39 !EnsureNotProcessingBuildConfig(function, scope, err))
36 return Value(); 40 return Value();
37 Scope block_scope(scope); 41 Scope block_scope(scope);
38 if (!FillTargetBlockScope(scope, function, target_type, block, 42 if (!FillTargetBlockScope(scope, function, target_type, block,
39 args, &block_scope, err)) 43 args, &block_scope, err))
40 return Value(); 44 return Value();
41 45
42 block->Execute(&block_scope, err); 46 block->Execute(&block_scope, err);
43 if (err->has_error()) 47 if (err->has_error())
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 const Template* templ = scope->GetTemplate(target_type); 520 const Template* templ = scope->GetTemplate(target_type);
517 if (templ) 521 if (templ)
518 return templ->Invoke(scope, function, sub_args, block, err); 522 return templ->Invoke(scope, function, sub_args, block, err);
519 523
520 // Otherwise, assume the target is a built-in target type. 524 // Otherwise, assume the target is a built-in target type.
521 return ExecuteGenericTarget(target_type.c_str(), scope, function, sub_args, 525 return ExecuteGenericTarget(target_type.c_str(), scope, function, sub_args,
522 block, err); 526 block, err);
523 } 527 }
524 528
525 } // namespace functions 529 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/functions.cc ('k') | tools/gn/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698