Got some sort of class allocator node created, now to re-order it by using Context to be able to know when the StaticVariableDeclaration is within class.

This then generates code to allocate space for the class, once done we can be assured the declarations (placed after it now) will be assigning to properly allocated space (paged and maped for example)
This commit is contained in:
Tristan B. Velloza Kildaire 2021-11-10 17:15:27 +02:00
parent cae3cfe88c
commit 3da50e9eab
3 changed files with 22 additions and 0 deletions

View File

@ -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 */

View File

@ -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)

View File

@ -26,6 +26,8 @@ public class VariableNode : DNode
{
name = resolver.generateName(cast(Container)dnodegen.root.getEntity(), cast(Entity)entity);
}
}
public class ModuleVariableDeclaration : VariableNode