OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/err.h" | 5 #include "tools/gn/err.h" |
6 #include "tools/gn/filesystem_utils.h" | 6 #include "tools/gn/filesystem_utils.h" |
7 #include "tools/gn/functions.h" | 7 #include "tools/gn/functions.h" |
8 #include "tools/gn/label.h" | 8 #include "tools/gn/label.h" |
9 #include "tools/gn/parse_tree.h" | 9 #include "tools/gn/parse_tree.h" |
10 #include "tools/gn/value.h" | 10 #include "tools/gn/value.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 const FunctionCallNode* function, | 85 const FunctionCallNode* function, |
86 const std::vector<Value>& args, | 86 const std::vector<Value>& args, |
87 Err* err) { | 87 Err* err) { |
88 if (args.size() != 2) { | 88 if (args.size() != 2) { |
89 *err = Err(function, "Expected two arguments."); | 89 *err = Err(function, "Expected two arguments."); |
90 return Value(); | 90 return Value(); |
91 } | 91 } |
92 | 92 |
93 // Resolve the requested label. | 93 // Resolve the requested label. |
94 Label label = Label::Resolve(scope->GetSourceDir(), | 94 Label label = Label::Resolve(scope->GetSourceDir(), |
95 ToolchainLabelForScope(scope), args[0], err); | 95 ToolchainLabelForScope(scope), args[0], |
| 96 scope->settings()->build_settings()->root_path(), |
| 97 err); |
96 if (label.is_null()) | 98 if (label.is_null()) |
97 return Value(); | 99 return Value(); |
98 | 100 |
99 // Extract the "what" parameter. | 101 // Extract the "what" parameter. |
100 if (!args[1].VerifyTypeIs(Value::STRING, err)) | 102 if (!args[1].VerifyTypeIs(Value::STRING, err)) |
101 return Value(); | 103 return Value(); |
102 const std::string& what = args[1].string_value(); | 104 const std::string& what = args[1].string_value(); |
103 | 105 |
104 Value result(function, Value::STRING); | 106 Value result(function, Value::STRING); |
105 if (what == "name") { | 107 if (what == "name") { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 146 |
145 } else { | 147 } else { |
146 *err = Err(args[1], "Unknown value for \"what\" parameter."); | 148 *err = Err(args[1], "Unknown value for \"what\" parameter."); |
147 return Value(); | 149 return Value(); |
148 } | 150 } |
149 | 151 |
150 return result; | 152 return result; |
151 } | 153 } |
152 | 154 |
153 } // namespace functions | 155 } // namespace functions |
OLD | NEW |