add more expressive message for undefined variable
This commit is contained in:
@ -120,6 +120,12 @@ public final class TypeChecker {
|
|||||||
|
|
||||||
final String childReturnType = nodeTable.get(child);
|
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)) {
|
if (!requiredType.contains(childReturnType)) {
|
||||||
// Child returned Typ, welcher nicht im SymbolTable als Argumenttyp steht
|
// Child returned Typ, welcher nicht im SymbolTable als Argumenttyp steht
|
||||||
// Der NodeTable enthält auch Literale, diese müssen also nicht einzeln behandelt werden
|
// Der NodeTable enthält auch Literale, diese müssen also nicht einzeln behandelt werden
|
||||||
|
|||||||
Reference in New Issue
Block a user