added a unique identifier to scopes to uniquely identify them
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 2 Feb 2021 21:13:23 +0000 (15:13 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 2 Feb 2021 21:13:23 +0000 (15:13 -0600)
bin/onyx
include/bh.h
include/onyxastnodes.h
onyx.exe
src/onyxchecker.c
src/onyxutils.c

index 705f3739f1cc961268f959665e7de9738678cef6..247034e8fa5186074a36282a8b1521dfb725ee63 100755 (executable)
Binary files a/bin/onyx and b/bin/onyx differ
index c95af10e4efdeee836e15fabe30dc11dc4009f5b..f75dd1cfea125f34bcdfa7f8689f2e0394724f07 100644 (file)
@@ -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;
index 5d477b6c4e9848ca9e567697d22231ca5b8386f9..7ca3b8f158c226c090471aa5b74195afb3f49296 100644 (file)
@@ -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;
index e0845ccfbabd952be4b177dc452106665b448dcf..4a8203e58d698d8f936efbd94baefc3dbb60e132 100644 (file)
Binary files a/onyx.exe and b/onyx.exe differ
index c825d36f0727cb4d9c5216e523c370bef92599f0..df291d41ae106dd39b0e59e61e87a73b4f0d9232 100644 (file)
@@ -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;
index b9fc364d4bd6888b39ca520fe0bb2971e9edb8f2..f09493214e4276ac84f9e4482fd84feccf2033ec 100644 (file)
@@ -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;