Implemented the typeCheck in TypedConstructor

This commit is contained in:
ahmad 2024-05-12 15:54:44 +02:00
parent ede0b38987
commit 7c4ea4b7e2

View File

@ -65,11 +65,16 @@ public class TypedConstructor implements TypedNode {
public void convertToBlock(TypedClass clas, Constructor unTypedConstructor) {
this.typedBlock = new TypedBlock(clas, unTypedConstructor.block());
typeCheck(clas);
}
@Override
public Type typeCheck(TypedClass clas) {
//TODO: check if return is there
type = typedBlock.typeCheck(clas);
if(type != Type.VOID){
throw new RuntimeException("Constructor must not habe a return statement");
}
return type;
}