Commit 39380669 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

The parser needs to a valid AST when the parsing method returns `true'.

parent 80e26d86
...@@ -4053,7 +4053,7 @@ bool Parser::parseObjCInterface(DeclarationAST *&node, ...@@ -4053,7 +4053,7 @@ bool Parser::parseObjCInterface(DeclarationAST *&node,
match(T_RPAREN, &(ast->rparen_token)); match(T_RPAREN, &(ast->rparen_token));
parseObjCProtocolRefs(ast->protocol_refs); parseObjCProtocolRefs(ast->protocol_refs);
DeclarationListAST **nextMembers = &(ast->member_declarations); DeclarationListAST **nextMembers = &(ast->member_declarations);
DeclarationAST *declaration = 0; DeclarationAST *declaration = 0;
while (parseObjCInterfaceMemberDeclaration(declaration)) { while (parseObjCInterfaceMemberDeclaration(declaration)) {
...@@ -4317,7 +4317,7 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node) ...@@ -4317,7 +4317,7 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node)
bool Parser::parseObjCMethodDefinition(DeclarationAST *&node) bool Parser::parseObjCMethodDefinition(DeclarationAST *&node)
{ {
ObjCMethodPrototypeAST *method_prototype; ObjCMethodPrototypeAST *method_prototype = 0;
if (! parseObjCMethodPrototype(method_prototype)) if (! parseObjCMethodPrototype(method_prototype))
return false; return false;
...@@ -4565,14 +4565,10 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node) ...@@ -4565,14 +4565,10 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node)
DeclarationAST *parameter_declaration = 0; DeclarationAST *parameter_declaration = 0;
parseParameterDeclaration(parameter_declaration); parseParameterDeclaration(parameter_declaration);
} }
node = ast;
} else if (lookAtObjCSelector()) { } else if (lookAtObjCSelector()) {
ObjCSelectorWithoutArgumentsAST *sel = new (_pool) ObjCSelectorWithoutArgumentsAST; ObjCSelectorWithoutArgumentsAST *sel = new (_pool) ObjCSelectorWithoutArgumentsAST;
parseObjCSelector(sel->name_token); parseObjCSelector(sel->name_token);
ast->selector = sel; ast->selector = sel;
node = ast;
} else { } else {
_translationUnit->error(cursor(), "expected a selector"); _translationUnit->error(cursor(), "expected a selector");
} }
...@@ -4581,6 +4577,7 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node) ...@@ -4581,6 +4577,7 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node)
while (parseAttributeSpecifier(*attr)) while (parseAttributeSpecifier(*attr))
attr = &(*attr)->next; attr = &(*attr)->next;
node = ast;
return true; return true;
} }
......
Markdown is supported
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