aboutsummaryrefslogtreecommitdiff
path: root/src/compiler.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-01-16 10:44:27 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2025-01-16 10:44:27 +0200
commit4d812e9b9bcf2530ab5a3275be85365ee277bea8 (patch)
tree07e22bb7d3fd9f0464b09f502ada9843d138b9dc /src/compiler.c
parent8edffa1263dc1660c8c383467974933179931cfa (diff)
downloadek-4d812e9b9bcf2530ab5a3275be85365ee277bea8.tar.gz
ek-4d812e9b9bcf2530ab5a3275be85365ee277bea8.zip
use maps for scope
Diffstat (limited to 'src/compiler.c')
-rw-r--r--src/compiler.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler.c b/src/compiler.c
index 2041efd..7ce6167 100644
--- a/src/compiler.c
+++ b/src/compiler.c
@@ -132,8 +132,8 @@ static int process(struct scope **parent, int public, const char *file)
static int copy_scope(struct scope *to, struct scope *from)
{
/** @todo handle duplicates */
- foreach_visible(n, from->symbols) {
- struct ast *def = n->node;
+ foreach(visible, n, &from->symbols) {
+ struct ast *def = n->data;
if (!ast_flags(def, AST_FLAG_PUBLIC))
continue;
@@ -206,6 +206,7 @@ int process_file(struct scope **scope, int public, const char *file)
if (copy_scope(*scope, *exists))
goto out;
+ free(real);
} else {
if (process(scope, public, base))
goto out;