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

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

Issue 2940873002: Implement tracking of BUILD.gn files used to define target, toolchain or (Closed)
Patch Set: Created 3 years, 6 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/input_conversion.h" 5 #include "tools/gn/input_conversion.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 *parse_root_ptr = Parser::Parse(*tokens, err); // Will return a Block. 67 *parse_root_ptr = Parser::Parse(*tokens, err); // Will return a Block.
68 if (err->has_error()) 68 if (err->has_error())
69 return Value(); 69 return Value();
70 ParseNode* parse_root = parse_root_ptr->get(); // For nicer syntax below. 70 ParseNode* parse_root = parse_root_ptr->get(); // For nicer syntax below.
71 71
72 // It's valid for the result to be a null pointer, this just means that the 72 // It's valid for the result to be a null pointer, this just means that the
73 // script returned nothing. 73 // script returned nothing.
74 if (!parse_root) 74 if (!parse_root)
75 return Value(); 75 return Value();
76 76
77 std::unique_ptr<Scope> scope(new Scope(settings)); 77 std::unique_ptr<Scope> scope(
78 new Scope(settings, {base::Hash(input_file->name().value())}));
78 Value result = parse_root->Execute(scope.get(), err); 79 Value result = parse_root->Execute(scope.get(), err);
79 if (err->has_error()) 80 if (err->has_error())
80 return Value(); 81 return Value();
81 82
82 // When we want the result as a scope, the result is actually the scope 83 // When we want the result as a scope, the result is actually the scope
83 // we made, rather than the result of running the block (which will be empty). 84 // we made, rather than the result of running the block (which will be empty).
84 if (what == PARSE_SCOPE) { 85 if (what == PARSE_SCOPE) {
85 DCHECK(result.type() == Value::NONE); 86 DCHECK(result.type() == Value::NONE);
86 result = Value(origin, std::move(scope)); 87 result = Value(origin, std::move(scope));
87 } 88 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 const ParseNode* origin, 205 const ParseNode* origin,
205 const Value& input_conversion_value, 206 const Value& input_conversion_value,
206 Err* err) { 207 Err* err) {
207 if (input_conversion_value.type() == Value::NONE) 208 if (input_conversion_value.type() == Value::NONE)
208 return Value(); // Allow null inputs to mean discard the result. 209 return Value(); // Allow null inputs to mean discard the result.
209 if (!input_conversion_value.VerifyTypeIs(Value::STRING, err)) 210 if (!input_conversion_value.VerifyTypeIs(Value::STRING, err))
210 return Value(); 211 return Value();
211 return DoConvertInputToValue(settings, input, origin, input_conversion_value, 212 return DoConvertInputToValue(settings, input, origin, input_conversion_value,
212 input_conversion_value.string_value(), err); 213 input_conversion_value.string_value(), err);
213 } 214 }
OLDNEW
« no previous file with comments | « tools/gn/inherited_libraries_unittest.cc ('k') | tools/gn/item.h » ('j') | tools/gn/scope.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698