From fba2b99b65d5023675a3f270adbc87ef0b0ede8f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 23 May 2024 12:40:21 -0400 Subject: Support 'while when' --- compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compile.c') 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; -- cgit v1.2.3