mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 02:08:04 +00:00
Done TODOs for TypedWhile
This commit is contained in:
parent
9b12c843bc
commit
e9e4f8ccd3
@ -69,7 +69,7 @@ public class TypedBlock implements TypedNode {
|
||||
}
|
||||
if (stmt instanceof While whileStmt) {
|
||||
TypedWhile typedWhile = new TypedWhile(localVar, clas, whileStmt);
|
||||
//TODO: check the type
|
||||
typedWhile.typeCheck(localVar, clas);
|
||||
stmts.add(typedWhile);
|
||||
continue;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import static de.maishai.typedast.Util.TypedExpressionUtil.getKindOfExpression;
|
||||
public class TypedWhile implements TypedStatement {
|
||||
private TypedExpression cond;
|
||||
private TypedBlock typedBlock;
|
||||
private Type type;
|
||||
|
||||
public TypedWhile(Map<String, Type> localVar, TypedClass clas, While unTypedWhile) {
|
||||
convertToTypedWhile(localVar, clas, unTypedWhile);
|
||||
@ -28,6 +29,7 @@ public class TypedWhile implements TypedStatement {
|
||||
throw new RuntimeException("While condition must be a boolean");
|
||||
}
|
||||
typedBlock.typeCheck(localVar, clas);
|
||||
this.type = Type.VOID;
|
||||
return Type.BOOL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user