Commit 4e788157 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Parser fix for ObjC methods.

parent 2e181127
......@@ -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;
}
......
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