Commit b1af22b3 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Fixed error recovery when failing to parse Q_PROPERTY.

parent 28d72550
...@@ -1822,11 +1822,12 @@ bool Parser::parseQtPropertyDeclaration(DeclarationAST *&node) ...@@ -1822,11 +1822,12 @@ bool Parser::parseQtPropertyDeclaration(DeclarationAST *&node)
QtPropertyDeclarationBoolItemAST *bItem = new (_pool) QtPropertyDeclarationBoolItemAST; QtPropertyDeclarationBoolItemAST *bItem = new (_pool) QtPropertyDeclarationBoolItemAST;
bItem->item_name_token = consumeToken(); bItem->item_name_token = consumeToken();
ExpressionAST *expr = 0; ExpressionAST *expr = 0;
if (parseBoolLiteral(expr)) if (parseBoolLiteral(expr)) {
bItem->bool_value = expr->asBoolLiteral(); bItem->bool_value = expr->asBoolLiteral();
else
_translationUnit->error(cursor(), "expected `true' or `false' before `%s'", tok().spell());
item = bItem; item = bItem;
} else {
_translationUnit->error(cursor(), "expected `true' or `false' before `%s'", tok().spell());
}
break; break;
} }
...@@ -1840,16 +1841,20 @@ bool Parser::parseQtPropertyDeclaration(DeclarationAST *&node) ...@@ -1840,16 +1841,20 @@ bool Parser::parseQtPropertyDeclaration(DeclarationAST *&node)
default: default:
_translationUnit->error(cursor(), "expected `)' before `%s'", tok().spell()); _translationUnit->error(cursor(), "expected `)' before `%s'", tok().spell());
return true; // skip the token
consumeToken();
} }
if (item) { if (item) {
*iter = new (_pool) QtPropertyDeclarationItemListAST; *iter = new (_pool) QtPropertyDeclarationItemListAST;
(*iter)->value = item; (*iter)->value = item;
iter = &(*iter)->next; iter = &(*iter)->next;
} }
} else if (!LA()) {
break;
} else { } else {
_translationUnit->error(cursor(), "expected `)' before `%s'", tok().spell()); _translationUnit->error(cursor(), "expected `)' before `%s'", tok().spell());
break; // skip the token
consumeToken();
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment