arrow lambdas allow single call expression

This commit is contained in:
2021-06-27 18:58:21 -06:00
parent eb43625f34
commit 68ff8008ad

View File

@@ -103,11 +103,11 @@ class Reader {
case Symbol(_): case Symbol(_):
argsExp = b.list([firstExp]); argsExp = b.list([firstExp]);
bodyExp = assertRead(stream, k); bodyExp = assertRead(stream, k);
case CallExp({pos: _, def: Symbol("begin")}, _): case CallExp(_, _):
argsExp = b.list([]); argsExp = b.list([]);
bodyExp = firstExp; bodyExp = firstExp;
default: default:
throw CompileError.fromExp(firstExp, "first expression after -> should be [args...], arg, or {body}, or one of those prefixed with :Void"); throw CompileError.fromExp(firstExp, "first expression after -> should be [args...], arg, (exp) or {body}, or one of those prefixed with :Void");
} }
if (!returnsValue) { if (!returnsValue) {
argsExp = TypedExp("Void", argsExp).withPosOf(argsExp); argsExp = TypedExp("Void", argsExp).withPosOf(argsExp);