From e8f78907830c525dccf1f4a5e6f97a15780c54ef Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 21 Jan 2025 20:32:39 +0200 Subject: 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 --- src/compiler.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/compiler.c') 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; } -- cgit v1.3