From 14814ecbf53760654aab34e0613abf347a54113f Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Thu, 14 Oct 2021 18:06:54 +0200 Subject: Add fun sugar for function variable declaration --- src/bootstrap/environment.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/bootstrap/environment.c') diff --git a/src/bootstrap/environment.c b/src/bootstrap/environment.c index e111753..78f31fb 100644 --- a/src/bootstrap/environment.c +++ b/src/bootstrap/environment.c @@ -106,15 +106,15 @@ env_extend(Environment *parent, Environment *extra) { for (size_t i = 0; i < extra->size; i++) { EnvEntry entry = extra->buf[i]; Environment *tmp = env; - ssize_t idx = -1; + bool found = false; while (tmp != NULL) { - idx = env_index_current(tmp, entry.symbol); - if (idx != -1) { + if (env_index_current(tmp, entry.symbol) != -1) { + found = true; break; } tmp = tmp->parent; } - if (idx == -1) { + if (!found) { env_add_symbol(env, obj_duplicate(entry.symbol), obj_duplicate(entry.value)); } } -- cgit v1.2.1