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/input_conversion.h" | 5 #include "tools/gn/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 19 matching lines...) Expand all Loading... |
30 const std::string& input, | 30 const std::string& input, |
31 ValueOrScope what, | 31 ValueOrScope what, |
32 const ParseNode* origin, | 32 const ParseNode* origin, |
33 Err* err) { | 33 Err* err) { |
34 // The memory for these will be kept around by the input file manager | 34 // The memory for these will be kept around by the input file manager |
35 // so the origin parse nodes for the values will be preserved. | 35 // so the origin parse nodes for the values will be preserved. |
36 InputFile* input_file; | 36 InputFile* input_file; |
37 std::vector<Token>* tokens; | 37 std::vector<Token>* tokens; |
38 scoped_ptr<ParseNode>* parse_root_ptr; | 38 scoped_ptr<ParseNode>* parse_root_ptr; |
39 g_scheduler->input_file_manager()->AddDynamicInput( | 39 g_scheduler->input_file_manager()->AddDynamicInput( |
40 &input_file, &tokens, &parse_root_ptr); | 40 SourceFile(), &input_file, &tokens, &parse_root_ptr); |
41 | 41 |
42 input_file->SetContents(input); | 42 input_file->SetContents(input); |
43 if (origin) { | 43 if (origin) { |
44 // This description will be the blame for any error messages caused by | 44 // This description will be the blame for any error messages caused by |
45 // script parsing or if a value is blamed. It will say | 45 // script parsing or if a value is blamed. It will say |
46 // "Error at <...>:line:char" so here we try to make a string for <...> | 46 // "Error at <...>:line:char" so here we try to make a string for <...> |
47 // that reads well in this context. | 47 // that reads well in this context. |
48 input_file->set_friendly_name( | 48 input_file->set_friendly_name( |
49 "dynamically parsed input that " + | 49 "dynamically parsed input that " + |
50 origin->GetRange().begin().Describe(true) + | 50 origin->GetRange().begin().Describe(true) + |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 const ParseNode* origin, | 208 const ParseNode* origin, |
209 const Value& input_conversion_value, | 209 const Value& input_conversion_value, |
210 Err* err) { | 210 Err* err) { |
211 if (input_conversion_value.type() == Value::NONE) | 211 if (input_conversion_value.type() == Value::NONE) |
212 return Value(); // Allow null inputs to mean discard the result. | 212 return Value(); // Allow null inputs to mean discard the result. |
213 if (!input_conversion_value.VerifyTypeIs(Value::STRING, err)) | 213 if (!input_conversion_value.VerifyTypeIs(Value::STRING, err)) |
214 return Value(); | 214 return Value(); |
215 return DoConvertInputToValue(settings, input, origin, input_conversion_value, | 215 return DoConvertInputToValue(settings, input, origin, input_conversion_value, |
216 input_conversion_value.string_value(), err); | 216 input_conversion_value.string_value(), err); |
217 } | 217 } |
OLD | NEW |