aboutsummaryrefslogtreecommitdiff
path: root/src/compiler.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-01-21 20:32:39 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2025-01-21 20:32:39 +0200
commite8f78907830c525dccf1f4a5e6f97a15780c54ef (patch)
tree616bf72243e22cfb034cf2fab4bb99a927db61da /src/compiler.c
parent284be00c81407735cc8ddec1f1353b867b2deffd (diff)
downloadek-e8f78907830c525dccf1f4a5e6f97a15780c54ef.tar.gz
ek-e8f78907830c525dccf1f4a5e6f97a15780c54ef.zip
add type visibility checks
+ Essentially require that each type used in a public symbol only use types that are exported out of the file as well
Diffstat (limited to 'src/compiler.c')
-rw-r--r--src/compiler.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/compiler.c b/src/compiler.c
index 881326c..d865ea5 100644
--- a/src/compiler.c
+++ b/src/compiler.c
@@ -171,13 +171,14 @@ struct scope *process_file(const char *file)
return *exists;
} else {
struct scope *scope = create_scope();
- if (process(scope, base)) {
- destroy_scope(scope);
- free(real);
- goto out;
- }
+ if (scopes_len(&scopes) == 0)
+ scope_set_flags(scope, SCOPE_ROOT);
scopes_insert(&scopes, real, scope);
+
+ if (process(scope, base))
+ goto out;
+
res_destroy(r);
return scope;
}