diff --git a/engine/parser.c b/engine/parser.c index dcd3cd7..f07aa14 100644 --- a/engine/parser.c +++ b/engine/parser.c @@ -700,7 +700,7 @@ static sxi32 ExprExtractNode(ph7_gen_state *pGen, ph7_expr_node **ppNode) { } } } - } else if(nKeyword == PH7_KEYWORD_FUNCTION) { + } else if(pCur[1].nType & PH7_TK_LPAREN && (nKeyword & PH7_KEYWORD_TYPEDEF)) { /* Anonymous function */ if(&pCur[1] >= pGen->pEnd) { /* Assume a literal */ diff --git a/tests/callback_function.aer b/tests/callback_function.aer index 1cca0c3..f3b614d 100644 --- a/tests/callback_function.aer +++ b/tests/callback_function.aer @@ -1,7 +1,7 @@ class Program { function main(string[] $args) { - callback $y = function() { + callback $y = void() { callback $a = 'printf'; $a("I'm alive\n"); var_dump($a);