@@ -191,9 +191,9 @@ if( tryEat("fun") ) { eat("(", "after fun"); string[] params; - for(;;) + while(!tryEat(")")) { if( lex.empty ) { auto e = ParserException.create(lex,"Unexpected EOF"); throw e; @@ -308,5 +308,10 @@ new FunLiteralExpression(null, ["abc"], [ ]), new IntLiteralExpression(null, BigInt(4)) )))); +} +unittest +{ + auto p = parserFromString(`var x = 1; var f = fun(){x=x+1;}; f(); f(); x;`); + Program prog = p.parseProgram(); }