From 532287ffe97392c5b2b9f24646c5ec99095acd93 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Wed, 6 Nov 2019 10:39:34 -0500 Subject: compile time each! --- eval.c | 7 ++++--- main.c | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eval.c b/eval.c index 0933aec..3c44470 100644 --- a/eval.c +++ b/eval.c @@ -1218,19 +1218,20 @@ static bool eval_expr(Evaluator *ev, Expression *e, Value *v) { boolt.flags = TYPE_FLAG_RESOLVED; boolt.kind = TYPE_BUILTIN; boolt.builtin = BUILTIN_BOOL; - eval_numerical_bin_op(lhs, &ea->type, step_is_negative ? BINARY_GE : BINARY_LE, rhs, &ea->range.to->type, v, &boolt); + Value cont; + eval_numerical_bin_op(lhs, &ea->type, step_is_negative ? BINARY_GE : BINARY_LE, rhs, &ea->range.to->type, &cont, &boolt); - if (!v->boolv) break; + if (!cont.boolv) break; } if (value_val) *value_val = x; if (!eval_block(ev, &ea->body, &e->type, v)) return false; - if (index_val) { index_val->i64++; } eval_numerical_bin_op(x, &ea->type, BINARY_ADD, stepval, ea->range.stepval ? &ea->type : &i64t, &x, &ea->type); } + } else { Value of; if (!eval_expr(ev, ea->of, &of)) return false; diff --git a/main.c b/main.c index 9f487e0..7250218 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,5 @@ /* TODO: -compile-time each allow just each arr { ... } each pointer compile-time each pointer -- cgit v1.2.3