add more expressive message for undefined variable

This commit is contained in:
ChUrl
2021-01-22 16:43:29 +01:00
parent 3990cb0d29
commit c61c8dcb22

View File

@ -120,6 +120,12 @@ public final class TypeChecker {
final String childReturnType = nodeTable.get(child);
if (childReturnType == null) {
System.out.println("Variable " + child.getValue() + " wurde nicht deklariert.");
throw new SymbolNotDefinedException("Zugriff auf nicht deklarierte Variable " + child.getValue());
}
if (!requiredType.contains(childReturnType)) {
// Child returned Typ, welcher nicht im SymbolTable als Argumenttyp steht
// Der NodeTable enthält auch Literale, diese müssen also nicht einzeln behandelt werden