summaryrefslogtreecommitdiffstats
path: root/tools/gn
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-11 20:35:03 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-11 20:35:03 +0000
commit8f4f9a8431196e90af1d481e0662fa41011907c0 (patch)
treed675b61800d71c86c7551ada9e32d1fc6036a718 /tools/gn
parent7aa11da5ea062e8b55dce4d8a13f9d5610edfe5e (diff)
downloadchromium_src-8f4f9a8431196e90af1d481e0662fa41011907c0.zip
chromium_src-8f4f9a8431196e90af1d481e0662fa41011907c0.tar.gz
chromium_src-8f4f9a8431196e90af1d481e0662fa41011907c0.tar.bz2
gn: test and fix for swapped -= operator
R=brettw@chromium.org Review URL: https://chromiumcodereview.appspot.com/23484029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222619 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gn')
-rw-r--r--tools/gn/parser.cc2
-rw-r--r--tools/gn/parser_unittest.cc4
2 files changed, 6 insertions, 0 deletions
diff --git a/tools/gn/parser.cc b/tools/gn/parser.cc
index e507dfb..649d4cf 100644
--- a/tools/gn/parser.cc
+++ b/tools/gn/parser.cc
@@ -194,6 +194,8 @@ scoped_ptr<ParseNode> Parser::ParseExpression(int precedence) {
}
scoped_ptr<ParseNode> left = (this->*prefix)(token);
+ if (has_error())
+ return left.Pass();
while (!at_end() && !IsStatementBreak(cur_token().type()) &&
precedence <= expressions_[cur_token().type()].precedence) {
diff --git a/tools/gn/parser_unittest.cc b/tools/gn/parser_unittest.cc
index 06464a2..7ef5ff6 100644
--- a/tools/gn/parser_unittest.cc
+++ b/tools/gn/parser_unittest.cc
@@ -475,3 +475,7 @@ TEST(Parser, LongExpression) {
TEST(Parser, HangingIf) {
DoParserErrorTest("if", 1, 1);
}
+
+TEST(Parser, NegatingList) {
+ DoParserErrorTest("executable(\"wee\") { sources =- [ \"foo.cc\" ] }", 1, 30);
+}