Chromium Code Reviews| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <limits> | 6 #include <limits> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "tools/gn/err.h" | 9 #include "tools/gn/err.h" |
| 10 #include "tools/gn/functions.h" | 10 #include "tools/gn/functions.h" |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 // Make sure there weren't any vars set in this tool that were unused. | 1037 // Make sure there weren't any vars set in this tool that were unused. |
| 1038 if (!block_scope.CheckForUnusedVars(err)) | 1038 if (!block_scope.CheckForUnusedVars(err)) |
| 1039 return Value(); | 1039 return Value(); |
| 1040 | 1040 |
| 1041 toolchain->SetTool(tool_type, std::move(tool)); | 1041 toolchain->SetTool(tool_type, std::move(tool)); |
| 1042 return Value(); | 1042 return Value(); |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 extern const char kToolchainArgs[] = "toolchain_args"; | |
|
scottmg
2016/08/12 20:04:24
Oh, those extern's were weird. I'm surprised that
| |
| 1046 extern const char kToolchainArgs_HelpShort[] = | |
| 1047 "toolchain_args: Set build arguments for toolchain build setup."; | |
| 1048 extern const char kToolchainArgs_Help[] = | |
| 1049 "toolchain_args: Set build arguments for toolchain build setup.\n" | |
| 1050 "\n" | |
| 1051 " DEPRECATED. Instead use:\n" | |
| 1052 " toolchain_args = { ... }\n" | |
| 1053 "\n" | |
| 1054 " See \"gn help toolchain\" for documentation.\n"; | |
| 1055 | |
| 1056 Value RunToolchainArgs(Scope* scope, | |
| 1057 const FunctionCallNode* function, | |
| 1058 const std::vector<Value>& args, | |
| 1059 BlockNode* block, | |
| 1060 Err* err) { | |
| 1061 // This is a backwards-compatible shim that converts the old form of: | |
| 1062 // toolchain_args() { | |
| 1063 // foo = bar | |
| 1064 // } | |
| 1065 // to the new form: | |
| 1066 // toolchain_args = { | |
| 1067 // foo = bar | |
| 1068 // } | |
| 1069 // It will be deleted when all users of toolchain_args as a function are | |
| 1070 // deleted. | |
| 1071 if (!args.empty()) { | |
| 1072 *err = Err(function->function(), "This function takes no arguments."); | |
| 1073 return Value(); | |
| 1074 } | |
| 1075 | |
| 1076 std::unique_ptr<Scope> block_scope(new Scope(scope)); | |
| 1077 block->Execute(block_scope.get(), err); | |
| 1078 if (err->has_error()) | |
| 1079 return Value(); | |
| 1080 | |
| 1081 block_scope->DetachFromContaining(); | |
| 1082 scope->SetValue("toolchain_args", Value(function, std::move(block_scope)), | |
| 1083 function); | |
| 1084 return Value(); | |
| 1085 } | |
| 1086 | |
| 1087 } // namespace functions | 1045 } // namespace functions |
| OLD | NEW |