Added recursive container check in `checkCotainer(COntainer)` on condition that current Entity being processed is a Container-typed Entity

parser_exception_before
Tristan B. V. Kildaire 2021-04-01 15:26:17 +02:00
parent da8cb92f8a
commit 8567d8baeb
2 changed files with 26 additions and 2 deletions

View File

@ -320,6 +320,25 @@ public final class TypeChecker
string entityPath = resolver.generateName(modulle, entity);
Parser.expect("Cannot have entity \""~entityPath~"\" with same name as entity \""~preExistingEntity~"\" within same container");
}
/**
* Otherwise this Entity is fine
*/
else
{
string fullPath = resolver.generateName(modulle, entity);
string containerNameFullPath = resolver.generateName(modulle, c);
gprintln("Entity \""~fullPath~"\" is allowed to be defined within container \""~containerNameFullPath~"\"");
/**
* Check if this Entity is a Container, if so, then
* apply the same round of checks within it
*/
Container possibleContainerEntity = cast(Container)entity;
if(possibleContainerEntity)
{
checkContainer(possibleContainerEntity);
}
}
}

View File

@ -28,12 +28,17 @@ class kl
class Shekshi
{
class Shekshi
class Shekshi1
{
}
int Shekshi;
class kl
{
}
int Shekshi2;
class G
{