mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 02:48:03 +00:00
Implemented the typeCheck in TypedConstructor
This commit is contained in:
parent
ede0b38987
commit
7c4ea4b7e2
@ -65,11 +65,16 @@ public class TypedConstructor implements TypedNode {
|
|||||||
|
|
||||||
public void convertToBlock(TypedClass clas, Constructor unTypedConstructor) {
|
public void convertToBlock(TypedClass clas, Constructor unTypedConstructor) {
|
||||||
this.typedBlock = new TypedBlock(clas, unTypedConstructor.block());
|
this.typedBlock = new TypedBlock(clas, unTypedConstructor.block());
|
||||||
|
typeCheck(clas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type typeCheck(TypedClass clas) {
|
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;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user