diff --git a/source/tlang/compiler/codegen/instruction.d b/source/tlang/compiler/codegen/instruction.d index b9429ea9..a293653d 100644 --- a/source/tlang/compiler/codegen/instruction.d +++ b/source/tlang/compiler/codegen/instruction.d @@ -36,6 +36,14 @@ public class StorageDeclaratio : Instruction } +public class ClassStaticInitAllocate : Instruction +{ + this(string className) + { + addInfo = "classStaticInitAllocate: "~className; + } +} + public class VariableAssignmentInstr : Instruction { /* Name of variable being declared */ diff --git a/source/tlang/compiler/typecheck/core.d b/source/tlang/compiler/typecheck/core.d index 1eb9b88a..8945bcd8 100644 --- a/source/tlang/compiler/typecheck/core.d +++ b/source/tlang/compiler/typecheck/core.d @@ -284,6 +284,10 @@ public final class TypeChecker */ else if(cast(compiler.typecheck.dependency.variables.StaticVariableDeclaration)dnode) { + /* TODO: Add skipping if context is within a class */ + /* We need to wait for class static node, to do an InitInstruction (static init) */ + /* It probably makes sense , IDK, we need to allocate both classes */ + /** * Codegen * @@ -334,6 +338,14 @@ public final class TypeChecker } /* TODO: Add class init */ + else if(cast(compiler.typecheck.dependency.classes.classStaticDep.ClassStaticNode)dnode) + { + Clazz clazzPNode = cast(Clazz)dnode.getEntity(); + string clazzName = resolver.generateName(modulle, clazzPNode); + + /* TODO: I am rushing so idk which quantum op to use */ + addInstrB(new ClassStaticInitAllocate(clazzName)); + } /* It will pop a bunch of shiiit */ /* TODO: ANy statement */ else if(cast(compiler.typecheck.dependency.core.DNode)dnode) diff --git a/source/tlang/compiler/typecheck/dependency/variables.d b/source/tlang/compiler/typecheck/dependency/variables.d index 2f0a5939..3ba4b9ab 100644 --- a/source/tlang/compiler/typecheck/dependency/variables.d +++ b/source/tlang/compiler/typecheck/dependency/variables.d @@ -26,6 +26,8 @@ public class VariableNode : DNode { name = resolver.generateName(cast(Container)dnodegen.root.getEntity(), cast(Entity)entity); } + + } public class ModuleVariableDeclaration : VariableNode