From 393806696d0625c7998b29aa4a841860fb6bdac1 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Wed, 5 Aug 2009 09:45:12 +0200 Subject: The parser needs to a valid AST when the parsing method returns `true'. --- src/shared/cplusplus/Parser.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/shared/cplusplus/Parser.cpp') diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index c4eb17ab64..ee65f2c009 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -4053,7 +4053,7 @@ bool Parser::parseObjCInterface(DeclarationAST *&node, match(T_RPAREN, &(ast->rparen_token)); parseObjCProtocolRefs(ast->protocol_refs); - + DeclarationListAST **nextMembers = &(ast->member_declarations); DeclarationAST *declaration = 0; while (parseObjCInterfaceMemberDeclaration(declaration)) { @@ -4317,7 +4317,7 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node) bool Parser::parseObjCMethodDefinition(DeclarationAST *&node) { - ObjCMethodPrototypeAST *method_prototype; + ObjCMethodPrototypeAST *method_prototype = 0; if (! parseObjCMethodPrototype(method_prototype)) return false; @@ -4565,14 +4565,10 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node) DeclarationAST *parameter_declaration = 0; parseParameterDeclaration(parameter_declaration); } - - node = ast; } else if (lookAtObjCSelector()) { ObjCSelectorWithoutArgumentsAST *sel = new (_pool) ObjCSelectorWithoutArgumentsAST; parseObjCSelector(sel->name_token); ast->selector = sel; - - node = ast; } else { _translationUnit->error(cursor(), "expected a selector"); } @@ -4581,6 +4577,7 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node) while (parseAttributeSpecifier(*attr)) attr = &(*attr)->next; + node = ast; return true; } -- cgit v1.2.1