aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compile.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index 5cc37116..a15e058a 100644
--- a/compile.c
+++ b/compile.c
@@ -822,7 +822,8 @@ CORD compile_statement(env_t *env, ast_t *ast)
if (!to_print)
return CORD_EMPTY;
- CORD code = "say(Texts(";
+ CORD code = "say(";
+ if (to_print->next) code = CORD_all(code, "Texts(");
for (ast_list_t *chunk = to_print; chunk; chunk = chunk->next) {
if (chunk->ast->tag == TextLiteral) {
code = CORD_cat(code, compile(env, chunk->ast));
@@ -831,7 +832,8 @@ CORD compile_statement(env_t *env, ast_t *ast)
}
if (chunk->next) code = CORD_cat(code, ", ");
}
- return CORD_cat(code, "), yes);");
+ if (to_print->next) code = CORD_all(code, ")");
+ return CORD_cat(code, ", yes);");
}
case Return: {
if (!env->fn_ctx) code_err(ast, "This return statement is not inside any function");