diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index ea8b0f98e8237c7ffffb623e811202352a30bb4e..3ed4839928f43d9e7c457f72744ee706a6ed07ae 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -4347,14 +4347,16 @@ bool Parser::parseObjCMethodDefinition(DeclarationAST *&node) ObjCMethodDeclarationAST *ast = new (_pool) ObjCMethodDeclarationAST; ast->method_prototype = method_prototype; + // Objective-C allows you to write: + // - (void) foo; { body; } + // so a method is a forward declaration when it doesn't have a _body_. + // However, we still need to read the semicolon. if (LA() == T_SEMICOLON) { - // method declaration: ast->semicolon_token = consumeToken(); - } else { - // method definition: - parseFunctionBody(ast->function_body); } + parseFunctionBody(ast->function_body); + node = ast; return true; }