From eac31532c7efaae97e568bd8963d7155466f3bdd Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Mon, 7 Jun 2021 11:17:48 +0200 Subject: [PATCH] If a Variable declaration has a non-basic type that is a Class-type then that class should have its static initialization run (we should make sure it is reachable however) --- source/tlang/compiler/typecheck/dependancy.d | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/tlang/compiler/typecheck/dependancy.d b/source/tlang/compiler/typecheck/dependancy.d index 8da2765..0a6dcba 100644 --- a/source/tlang/compiler/typecheck/dependancy.d +++ b/source/tlang/compiler/typecheck/dependancy.d @@ -57,6 +57,9 @@ public final class StructuralOrganizer Clazz classType = cast(Clazz)type; /* TODO: Ensure that we set dependences as A.B.C with A B C all static */ + + /* Mark the variable as dependent on having sttaic init for class-type class */ + variable.addDep(classType); } @@ -89,7 +92,7 @@ public final class StructuralOrganizer foreach(Entity entity; entities) { /* Print the Entity's dependencies */ - gprintln("Entity ("~entity.getName()~"): "~to!(string)(entity.getDeps())); + gprintln("Entity ("~entity.getName()~") Deps: "~to!(string)(entity.getDeps()), DebugType.WARNING); /* if the ENtity is a container then apply recursively */ if(cast(Container)entity)