Prevent non-static classes from being used as a type in static initialization

This commit is contained in:
Tristan B. Kildaire 2021-06-07 13:59:12 +02:00
parent 2ac0e18aac
commit 7e05c1cbdb
1 changed files with 10 additions and 1 deletions

View File

@ -4,8 +4,8 @@ import gogga;
import compiler.symbols.data;
import compiler.symbols.typing.core;
import compiler.typecheck.core;
import std.conv : to;
import compiler.parsing.core;
public final class StructuralOrganizer
{
@ -128,6 +128,15 @@ public final class StructuralOrganizer
*/
public TreeNode staticInitializeClass(Clazz clazz)
{
/**
* This is a recursive static initiliazer, all classes
* must be static
*/
if(clazz.getModifierType() != InitScope.STATIC)
{
Parser.expect("Cannot use a class type that is of a class that is non-static");
}
/**
* This Class's TreeNode
*/