@@ -306,10 +306,11 @@ zzz = zzz + zzz * "fo\no"; # comment 42; `); - auto s0 = new DeclStatement(null, "zzz", new IntLiteralExpression(null, BigInt(100))); - auto s1 = new ExprStatement(null, new AssignExpression(null, + mixin EasyAst; + auto s0 = decl("zzz", intl(BigInt(100))); + auto s1 = expr( new AssignExpression(null, new VarExpression(null, "zzz"), new FuncallExpression(null, new VarExpression(null,"+"), new VarExpression(null, "zzz"), new FuncallExpression(null, new VarExpression(null,"*"), @@ -329,24 +330,21 @@ { auto p = parserFromString(` var f = fun(x,y){x+y;}; f(1,fun(abc){}(4)); - `); + `); + mixin EasyAst; Program prog = p.parseProgram(); assert( prog.length == 2 ); - assert( prog[0] == new DeclStatement(null, "f", new FunLiteralExpression(null, - ["x","y"], [new ExprStatement(null, - new FuncallExpression(null, new VarExpression(null, "+"), - new VarExpression(null, "x"), new VarExpression(null, "y")))] - ))); - assert( prog[1] == new ExprStatement(null, new FuncallExpression(null, - new VarExpression(null, "f"), - new IntLiteralExpression(null, BigInt(1)), - new FuncallExpression(null, - new FunLiteralExpression(null, ["abc"], [ - ]), - new IntLiteralExpression(null, BigInt(4)) - )))); + assert( prog[0] == decl("f", fun( + ["x","y"], [expr(funcall(var("+"), var("x"), var("y")))] + ))); + assert( prog[1] == expr(funcall(var("f"), + intl(BigInt(1)), + funcall( + fun(["abc"], cast(Statement[])[]), + intl(BigInt(4)) + )))); } unittest {