mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 04:38:16 +00:00
Fix minimal dependency for nested entities
This commit is contained in:
@@ -447,7 +447,10 @@ void add_dependency(DeclInfo *d, Entity *e) {
|
||||
}
|
||||
|
||||
void add_declaration_dependency(Checker *c, Entity *e) {
|
||||
if (c->context.decl) {
|
||||
if (e == NULL) {
|
||||
return;
|
||||
}
|
||||
if (c->context.decl != NULL) {
|
||||
auto found = map_get(&c->info.entities, hash_pointer(e));
|
||||
if (found) {
|
||||
add_dependency(c->context.decl, e);
|
||||
|
||||
@@ -33,13 +33,14 @@ void check_stmt_list(Checker *c, AstNodeArray stmts, u32 flags) {
|
||||
|
||||
Entity *e = make_entity_constant(c->allocator, c->context.scope, name->Ident, NULL, v);
|
||||
e->identifier = name;
|
||||
add_entity(c, e->scope, name, e);
|
||||
|
||||
DeclInfo *di = make_declaration_info(c->allocator, e->scope);
|
||||
di->type_expr = cd->type;
|
||||
di->init_expr = value;
|
||||
DeclInfo *d = make_declaration_info(c->allocator, e->scope);
|
||||
d->type_expr = cd->type;
|
||||
d->init_expr = value;
|
||||
|
||||
Delay delay = {e, di};
|
||||
add_entity_and_decl_info(c, name, e, d);
|
||||
|
||||
Delay delay = {e, d};
|
||||
gb_array_append(delayed_const, delay);
|
||||
}
|
||||
|
||||
@@ -61,6 +62,8 @@ void check_stmt_list(Checker *c, AstNodeArray stmts, u32 flags) {
|
||||
DeclInfo *d = make_declaration_info(c->allocator, e->scope);
|
||||
d->type_expr = td->type;
|
||||
|
||||
add_entity_and_decl_info(c, td->name, e, d);
|
||||
|
||||
Delay delay = {e, d};
|
||||
gb_array_append(delayed_type, delay);
|
||||
case_end;
|
||||
@@ -1531,11 +1534,11 @@ void check_stmt(Checker *c, AstNode *node, u32 flags) {
|
||||
// e.g. using
|
||||
Entity *e = make_entity_procedure(c->allocator, c->context.scope, pd->name->Ident, NULL);
|
||||
e->identifier = pd->name;
|
||||
add_entity(c, c->context.scope, pd->name, e);
|
||||
|
||||
DeclInfo *d = make_declaration_info(c->allocator, e->scope);
|
||||
d->proc_decl = node;
|
||||
|
||||
add_entity_and_decl_info(c, pd->name, e, d);
|
||||
check_entity_decl(c, e, d, NULL);
|
||||
case_end;
|
||||
|
||||
|
||||
@@ -499,6 +499,7 @@ b32 is_type_u8_slice(Type *t) {
|
||||
return false;
|
||||
}
|
||||
b32 is_type_vector(Type *t) {
|
||||
t = base_type(t);
|
||||
return t->kind == Type_Vector;
|
||||
}
|
||||
b32 is_type_proc(Type *t) {
|
||||
@@ -507,7 +508,8 @@ b32 is_type_proc(Type *t) {
|
||||
}
|
||||
Type *base_vector_type(Type *t) {
|
||||
if (is_type_vector(t)) {
|
||||
return base_type(t)->Vector.elem;
|
||||
t = base_type(t);
|
||||
return t->Vector.elem;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user