From 187cbc7610bded94d53d4fd561ad6d04dbe45ff4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 13 Feb 2024 22:56:10 -0500 Subject: Whitespace and ordering tweaks --- compile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 1dfd3c26..414d9871 100644 --- a/compile.c +++ b/compile.c @@ -223,11 +223,12 @@ CORD compile(env_t *env, ast_t *ast) if (arg->next) passed_args = CORD_cat(passed_args, ", "); } CORD_appendf(&kwargs, "} __args = {__VA_ARGS__}; %r_(%r); })\n", name, passed_args); + CORD_appendf(&env->staticdefs, "%r", kwargs); CORD body = compile(env, fndef->body); if (CORD_fetch(body, 0) != '{') body = CORD_asprintf("{\n%r\n}", body); - CORD_appendf(&env->funcs, ") %r\n%r", body, kwargs); + CORD_appendf(&env->funcs, ") %r", body); return CORD_EMPTY; } case FunctionCall: { @@ -349,7 +350,7 @@ CORD compile(env_t *env, ast_t *ast) if (test->expr->tag == Declare) { auto decl = Match(test->expr, Declare); return CORD_asprintf( - "__declare(%r, %r);\n__test(%r, %r, %r);\n", + "__declare(%r, %r);\n__test(%r, %r, %r);", compile(env, decl->var), compile(env, decl->value), compile(env, WrapAST(test->expr, StringLiteral, .cord=src)), compile(env, decl->var), @@ -380,7 +381,7 @@ CORD compile(env_t *env, ast_t *ast) return CORD_cat(code, "\n}"); } else { return CORD_asprintf( - "__test(%r, %r, %r);\n", + "__test(%r, %r, %r);", compile(env, WrapAST(test->expr, StringLiteral, .cord=src)), compile(env, test->expr), compile(env, WrapAST(test->expr, StringLiteral, .cord=test->output))); -- cgit v1.2.3