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

Unified Diff: tools/gn/input_conversion.cc

Issue 1048913003: tools/gn: don't allow trailing junk or non-literals in "value" conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clang-format Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/gn/input_conversion_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/input_conversion.cc
diff --git a/tools/gn/input_conversion.cc b/tools/gn/input_conversion.cc
index 6369d2dbfa1e7accb8f43a1d8ae0d8f4b13eb0c0..3d9d355c8a346c3e38be5bff40cceabb45aa4d06 100644
--- a/tools/gn/input_conversion.cc
+++ b/tools/gn/input_conversion.cc
@@ -59,7 +59,7 @@ Value ParseValueOrScope(const Settings* settings,
// Parse the file according to what we're looking for.
if (what == PARSE_VALUE)
- *parse_root_ptr = Parser::ParseExpression(*tokens, err);
+ *parse_root_ptr = Parser::ParseValue(*tokens, err);
else
*parse_root_ptr = Parser::Parse(*tokens, err); // Will return a Block.
if (err->has_error())
@@ -71,15 +71,7 @@ Value ParseValueOrScope(const Settings* settings,
if (!parse_root)
return Value();
- // When parsing as a value, the result should either be a list or a literal,
- // anything else is invalid.
- if (what == PARSE_VALUE) {
- if (!parse_root->AsList() && !parse_root->AsLiteral())
- return Value();
- }
-
scoped_ptr<Scope> scope(new Scope(settings));
-
Value result = parse_root->Execute(scope.get(), err);
if (err->has_error())
return Value();
« no previous file with comments | « no previous file | tools/gn/input_conversion_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698