aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-05-23 12:40:21 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-05-23 12:40:21 -0400
commitfba2b99b65d5023675a3f270adbc87ef0b0ede8f (patch)
treec1af45c5b80c9813a48fcc25386f331786004c73 /compile.c
parent7a741e65e663d9ce9013691d2479c6fdba4b798b (diff)
Support 'while when'
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 9be60d77..f3a13309 100644
--- a/compile.c
+++ b/compile.c
@@ -623,7 +623,7 @@ CORD compile_statement(env_t *env, ast_t *ast)
CORD body = compile_statement(scope, while_->body);
if (loop_ctx.skip_label)
body = CORD_all(body, "\n", loop_ctx.skip_label, ": continue;");
- CORD loop = CORD_all("while (", compile(scope, while_->condition), ") {\n\t", body, "\n}");
+ CORD loop = CORD_all("while (", while_->condition ? compile(scope, while_->condition) : "yes", ") {\n\t", body, "\n}");
if (loop_ctx.stop_label)
loop = CORD_all(loop, "\n", loop_ctx.stop_label, ":;");
return loop;