| 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 if (!args[0].VerifyTypeIs(Value::STRING, err)) | 766 if (!args[0].VerifyTypeIs(Value::STRING, err)) |
| 767 return Value(); | 767 return Value(); |
| 768 const std::string& target_type = args[0].string_value(); | 768 const std::string& target_type = args[0].string_value(); |
| 769 | 769 |
| 770 // The rest of the args are passed to the function. | 770 // The rest of the args are passed to the function. |
| 771 std::vector<Value> sub_args(args.begin() + 1, args.end()); | 771 std::vector<Value> sub_args(args.begin() + 1, args.end()); |
| 772 | 772 |
| 773 // Run a template if it is one. | 773 // Run a template if it is one. |
| 774 const Template* templ = scope->GetTemplate(target_type); | 774 const Template* templ = scope->GetTemplate(target_type); |
| 775 if (templ) | 775 if (templ) |
| 776 return templ->Invoke(scope, function, sub_args, block, err); | 776 return templ->Invoke(scope, function, target_type, sub_args, block, err); |
| 777 | 777 |
| 778 // Otherwise, assume the target is a built-in target type. | 778 // Otherwise, assume the target is a built-in target type. |
| 779 return ExecuteGenericTarget(target_type.c_str(), scope, function, sub_args, | 779 return ExecuteGenericTarget(target_type.c_str(), scope, function, sub_args, |
| 780 block, err); | 780 block, err); |
| 781 } | 781 } |
| 782 | 782 |
| 783 } // namespace functions | 783 } // namespace functions |
| OLD | NEW |