mirror of https://github.com/tbklang/tlang.git
WIP
This commit is contained in:
parent
21cef84983
commit
8a32272660
|
@ -8,6 +8,7 @@ import compiler.parsing.core;
|
|||
import compiler.symbols.check;
|
||||
import compiler.symbols.data;
|
||||
import compiler.typecheck.core;
|
||||
import compiler.typecheck.exceptions;
|
||||
|
||||
void beginCompilation(string[] sourceFiles)
|
||||
{
|
||||
|
@ -47,7 +48,19 @@ void beginCompilation(string[] sourceFiles)
|
|||
Module modulle = parser.parse();
|
||||
|
||||
gprintln("Type checking and symbol resolution...");
|
||||
TypeChecker typeChecker = new TypeChecker(modulle);
|
||||
// try
|
||||
// {
|
||||
TypeChecker typeChecker = new TypeChecker(modulle);
|
||||
// }
|
||||
// catch(CollidingNameException e)
|
||||
// {
|
||||
|
||||
// }
|
||||
// catch(TypeCheckerException e)
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// typeChecker.check();
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ module compiler.typecheck.exceptions;
|
|||
|
||||
import compiler.typecheck.core;
|
||||
import compiler.symbols.data;
|
||||
import compiler.typecheck.resolution;
|
||||
|
||||
public class TypeCheckerException : Exception
|
||||
{
|
||||
|
@ -36,6 +37,18 @@ public final class CollidingNameException : TypeCheckerException
|
|||
|
||||
/* TODO: Set `msg` */
|
||||
/* TODO: (Gogga it) Generate the error message */
|
||||
if(isCollidingWithContainer())
|
||||
{
|
||||
string containerPath = typeChecker.getResolver().generateName(modulle, defined);
|
||||
string entityPath = typeChecker.getResolver().generateName(modulle, attempted);
|
||||
msg = "Cannot have entity \""~entityPath~"\" with same name as container \""~containerPath~"\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
string preExistingEntity = resolver.generateName(modulle, findPrecedence(c, entity.getName()));
|
||||
string entityPath = resolver.generateName(modulle, entity);
|
||||
msg = "Cannot have entity \""~entityPath~"\" with same name as entity \""~preExistingEntity~"\" within same container";
|
||||
}
|
||||
}
|
||||
|
||||
public bool isCollidingWithContainer()
|
||||
|
|
Loading…
Reference in New Issue