| 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 "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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |