diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-04 13:37:00 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-04 13:37:00 -0400 |
| commit | f605df823016b9de23325c0a9d950c542a4ba1d5 (patch) | |
| tree | 64959dd767adaa352fb3ae231256ed82cab3e280 | |
| parent | 97a964aa861e7c0066a0bf1f67469fbb93febcad (diff) | |
Minor codegen cleanup
| -rw-r--r-- | compile.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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"); |
