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

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

Issue 2148093002: GN: Use the correct defaults for templates invoked via target(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 (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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698