diff --git a/src/main/java/de/maishai/typedast/typedclass/TypedBlock.java b/src/main/java/de/maishai/typedast/typedclass/TypedBlock.java index e948495..6fe79e9 100644 --- a/src/main/java/de/maishai/typedast/typedclass/TypedBlock.java +++ b/src/main/java/de/maishai/typedast/typedclass/TypedBlock.java @@ -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; } diff --git a/src/main/java/de/maishai/typedast/typedclass/TypedWhile.java b/src/main/java/de/maishai/typedast/typedclass/TypedWhile.java index efe632d..8e83180 100644 --- a/src/main/java/de/maishai/typedast/typedclass/TypedWhile.java +++ b/src/main/java/de/maishai/typedast/typedclass/TypedWhile.java @@ -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 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; }