Update the typeCheck of TypedBlock

This commit is contained in:
ahmad 2024-05-12 14:55:03 +02:00
parent 3b1161e97a
commit 2322d161e6

View File

@ -98,18 +98,24 @@ public class TypedBlock implements TypedNode {
}
}
this.typeCheck(clas);
System.out.println("TypedBlock: " + this.toString());
}
@Override
public Type typeCheck(TypedClass clas) {
Type chekType = null;
for (TypedStatement stmt : stmts) {
stmt.typeCheck(clas);
if(stmt instanceof TypedReturn returnStmt) {
chekType = returnStmt.getType();
}
}
//TODO: Type von Return zurückgeben
type = Type.VOID;
if(chekType == null) {
chekType = Type.VOID;
}
type = chekType;
return type;
}