Fix minimal dependency generation for polymorphic structs (related to issue #121)

This commit is contained in:
gingerBill
2017-10-15 11:21:48 +01:00
parent 94762b56f6
commit e05fe1837d
4 changed files with 454 additions and 438 deletions
+11 -3
View File
@@ -818,8 +818,8 @@ void add_declaration_dependency(Checker *c, Entity *e) {
return;
}
if (c->context.decl != nullptr) {
DeclInfo *decl = decl_info_of_entity(&c->info, e);
if (decl) add_dependency(c->context.decl, e);
// DeclInfo *decl = decl_info_of_entity(&c->info, e);
add_dependency(c->context.decl, e);
}
}
@@ -1213,6 +1213,9 @@ void add_entity_use(Checker *c, AstNode *identifier, Entity *entity) {
if (identifier->kind != AstNode_Ident) {
return;
}
if (entity->identifier == nullptr) {
entity->identifier = identifier;
}
HashKey key = hash_node(identifier);
map_set(&c->info.uses, key, entity);
add_declaration_dependency(c, entity); // TODO(bill): Should this be here?
@@ -1435,10 +1438,14 @@ void add_dependency_to_map(PtrSet<Entity *> *map, CheckerInfo *info, Entity *ent
if (entity == nullptr) {
return;
}
String name = entity->token.string;
if (entity->type != nullptr &&
is_type_polymorphic(entity->type)) {
DeclInfo *decl = decl_info_of_entity(info, entity);
if (decl->gen_proc_type == nullptr) {
if (decl != nullptr && decl->gen_proc_type == nullptr) {
return;
}
}
@@ -1447,6 +1454,7 @@ void add_dependency_to_map(PtrSet<Entity *> *map, CheckerInfo *info, Entity *ent
return;
}
ptr_set_add(map, entity);
DeclInfo *decl = decl_info_of_entity(info, entity);
if (decl != nullptr) {