aboutsummaryrefslogtreecommitdiff
path: root/src/checker/checker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/checker/checker.cpp')
-rw-r--r--src/checker/checker.cpp33
1 files changed, 6 insertions, 27 deletions
diff --git a/src/checker/checker.cpp b/src/checker/checker.cpp
index f9000446e..c69b5d27e 100644
--- a/src/checker/checker.cpp
+++ b/src/checker/checker.cpp
@@ -267,6 +267,12 @@ CycleChecker *cycle_checker_add(CycleChecker *cc, Entity *e) {
return cc;
}
+void cycle_checker_destroy(CycleChecker *cc) {
+ if (cc != NULL && cc->path != NULL) {
+ gb_array_free(cc->path);
+ }
+}
+
Scope *make_scope(Scope *parent, gbAllocator allocator) {
@@ -871,33 +877,6 @@ Map<Entity *> generate_minimum_dependency_map(CheckerInfo *info, Entity *start)
#include "expr.cpp"
#include "stmt.cpp"
-
-
-struct CycleCheck {
- gbArray(Entity *) path; // HACK(bill): Memory Leak
-};
-
-void cycle_check_add(CycleCheck *cc, Entity *entity) {
- if (cc == NULL)
- return;
- if (cc->path == NULL) {
- gb_array_init(cc->path, gb_heap_allocator());
- }
- GB_ASSERT(entity->kind == Entity_TypeName);
- gb_array_append(cc->path, entity);
-}
-
-void check_type_name_cycles(Checker *c, CycleCheck *cc, Entity *e) {
- GB_ASSERT(e->kind == Entity_TypeName);
- Type *t = e->type;
- // if (t->kind == Type_Named) {
- // if (t->Named.type_name == e) {
- // gb_printf("Illegal cycle %.*s!!!\n", LIT(e->token.string));
- // GB_PANIC("!!!");
- // }
- // }
-}
-
void init_runtime_types(Checker *c) {
if (t_type_info == NULL) {
Entity *e = current_scope_lookup_entity(c->global_scope, make_string("Type_Info"));