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 "input_conversion.h" | 5 #include "input_conversion.h" |
6 | 6 |
7 #include "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "tools/gn/build_settings.h" | 9 #include "tools/gn/build_settings.h" |
10 #include "tools/gn/err.h" | 10 #include "tools/gn/err.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 return Value(); | 110 return Value(); |
111 | 111 |
112 // The result should either be a list or a literal, anything else is | 112 // The result should either be a list or a literal, anything else is |
113 // invalid. | 113 // invalid. |
114 if (!expression->AsList() && !expression->AsLiteral()) { | 114 if (!expression->AsList() && !expression->AsLiteral()) { |
115 *err = MakeParseErr(input, origin, Err()); | 115 *err = MakeParseErr(input, origin, Err()); |
116 return Value(); | 116 return Value(); |
117 } | 117 } |
118 | 118 |
119 BuildSettings build_settings; | 119 BuildSettings build_settings; |
120 Label empty_label; | 120 Settings settings(&build_settings, std::string()); |
121 Toolchain toolchain(empty_label); | |
122 Settings settings(&build_settings, &toolchain, std::string()); | |
123 Scope scope(&settings); | 121 Scope scope(&settings); |
124 | 122 |
125 Err nested_err; | 123 Err nested_err; |
126 Value result = expression->Execute(&scope, &nested_err); | 124 Value result = expression->Execute(&scope, &nested_err); |
127 if (nested_err.has_error()) { | 125 if (nested_err.has_error()) { |
128 *err = MakeParseErr(input, origin, nested_err); | 126 *err = MakeParseErr(input, origin, nested_err); |
129 return Value(); | 127 return Value(); |
130 } | 128 } |
131 | 129 |
132 // The returned value will have references to the temporary parse nodes we | 130 // The returned value will have references to the temporary parse nodes we |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 return ParseString(input, origin, err); | 194 return ParseString(input, origin, err); |
197 if (input_conversion == "string") | 195 if (input_conversion == "string") |
198 return Value(origin, input); | 196 return Value(origin, input); |
199 if (input_conversion == "list lines") | 197 if (input_conversion == "list lines") |
200 return ParseList(input, origin, err); | 198 return ParseList(input, origin, err); |
201 | 199 |
202 *err = Err(input_conversion_value, "Not a valid read file mode.", | 200 *err = Err(input_conversion_value, "Not a valid read file mode.", |
203 "Have you considered a career in retail?"); | 201 "Have you considered a career in retail?"); |
204 return Value(); | 202 return Value(); |
205 } | 203 } |
OLD | NEW |