Chromium Code Reviews| Index: tools/gn/parser.cc |
| diff --git a/tools/gn/parser.cc b/tools/gn/parser.cc |
| index d99b574c073cb9776066d638c83f1414d0800c49..4acd510328b0e3dd5df631036dfc6b26af25aa66 100644 |
| --- a/tools/gn/parser.cc |
| +++ b/tools/gn/parser.cc |
| @@ -499,8 +499,13 @@ scoped_ptr<ParseNode> Parser::ParseCondition() { |
| *err_ = Err(condition->condition(), "Assignment not allowed in 'if'."); |
| Consume(Token::RIGHT_PAREN, "Expected ')' after condition of 'if'."); |
| condition->set_if_true(ParseBlock().Pass()); |
| - if (Match(Token::ELSE)) |
| + if (Match(Token::ELSE)) { |
| + if (!LookAhead(Token::LEFT_BRACE) && !LookAhead(Token::IF)) { |
|
tfarina
2015/03/10 20:37:24
|| here does the wrong thing?
Anyway, thanks for
scottmg
2015/03/10 21:21:00
I'm not sure what you mean. Right now it says "if
|
| + *err_ = Err(cur_token(), "Expected '{' or 'if' after 'else'."); |
| + return scoped_ptr<ParseNode>(); |
|
tfarina
2015/03/10 20:37:24
This can be return nullptr;
scottmg
2015/03/10 21:21:00
There's a whole bunch that predate nullptr in this
|
| + } |
| condition->set_if_false(ParseStatement().Pass()); |
| + } |
| if (has_error()) |
| return scoped_ptr<ParseNode>(); |
| return condition.Pass(); |