From: Brendan Hansen Date: Tue, 2 Feb 2021 21:13:23 +0000 (-0600) Subject: added a unique identifier to scopes to uniquely identify them X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=94b2980308a950744a4c4eca0a53937dbefd230d;p=onyx.git added a unique identifier to scopes to uniquely identify them --- diff --git a/bin/onyx b/bin/onyx index 705f3739..247034e8 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/include/bh.h b/include/bh.h index c95af10e..f75dd1cf 100644 --- a/include/bh.h +++ b/include/bh.h @@ -1001,11 +1001,9 @@ BH_ALLOCATOR_PROC(bh_arena_allocator_proc) { switch (action) { case bh_allocator_action_alloc: { - + bh_align(size, alignment); bh_align(alloc_arena->size, alignment); - // TODO: Do this better because right now bh__align is bad - // size = bh__align(size, alignment); if (size > alloc_arena->arena_size - size_of(ptr)) { // Size too large for the arena return NULL; diff --git a/include/onyxastnodes.h b/include/onyxastnodes.h index 5d477b6c..7ca3b8f1 100644 --- a/include/onyxastnodes.h +++ b/include/onyxastnodes.h @@ -78,6 +78,7 @@ typedef struct AstPackage AstPackage; typedef struct Package Package; typedef struct Scope { + u64 id; struct Scope *parent; OnyxFilePos created_at; bh_table(AstNode *) symbols; diff --git a/onyx.exe b/onyx.exe index e0845ccf..4a8203e5 100644 Binary files a/onyx.exe and b/onyx.exe differ diff --git a/src/onyxchecker.c b/src/onyxchecker.c index c825d36f..df291d41 100644 --- a/src/onyxchecker.c +++ b/src/onyxchecker.c @@ -1372,6 +1372,12 @@ CheckStatus check_expression(AstTyped** pexpr) { return Check_Success; } + if (expr->kind == Ast_Kind_Polymorphic_Proc) { + // Polymoprhic procedures do not need to be checked. Their concrete instantiations + // will be checked when they are created. + return Check_Success; + } + fill_in_type(expr); CheckStatus retval = Check_Success; diff --git a/src/onyxutils.c b/src/onyxutils.c index b9fc364d..f0949321 100644 --- a/src/onyxutils.c +++ b/src/onyxutils.c @@ -48,12 +48,15 @@ Package* package_lookup_or_create(char* package_name, Scope* parent_scope, bh_al // // Scoping // +static u64 next_scope_id = 1; + Scope* scope_create(bh_allocator a, Scope* parent, OnyxFilePos created_at) { Scope* scope = bh_alloc_item(a, Scope); + scope->id = next_scope_id++; scope->parent = parent; scope->created_at = created_at; - scope->symbols = NULL; + scope->symbols = NULL; bh_table_init(global_heap_allocator, scope->symbols, 64); return scope;