bugfix with looping scopes
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 26 Oct 2022 15:25:21 +0000 (10:25 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 26 Oct 2022 15:25:21 +0000 (10:25 -0500)
compiler/src/symres.c

index 5fdc45f9a51f0c4cb03550523e8ae5ded1960cb0..f37633531e48ba856cb4efed90377aeda31b6c95 100644 (file)
@@ -113,8 +113,9 @@ static SymresStatus symres_struct_type(AstStructType* s_node) {
     s_node->flags |= Ast_Flag_Comptime;
 
     if (s_node->scope) {
-        // FIX: This is probably wrong for the long term.
-        s_node->scope->parent = curr_scope;
+        assert(s_node->entity);
+        assert(s_node->entity->scope);
+        s_node->scope->parent = s_node->entity->scope;
 
         scope_enter(s_node->scope);
     }