Done TODOs for TypedDoWhile

This commit is contained in:
ahmad 2024-05-10 08:33:39 +02:00
parent e9e4f8ccd3
commit e63d7999a2
2 changed files with 3 additions and 2 deletions

View File

@ -75,7 +75,7 @@ public class TypedBlock implements TypedNode {
}
if (stmt instanceof DoWhile doWhile) {
TypedDoWhile typedDoWhile = new TypedDoWhile(localVar, clas, doWhile);
//TODO: check the type
typedDoWhile.typeCheck(localVar, clas);
stmts.add(typedDoWhile);
continue;
}
@ -104,7 +104,6 @@ public class TypedBlock implements TypedNode {
}
}
}
System.out.println("typedBlock: " + this.toString());
}
@Override

View File

@ -13,6 +13,7 @@ import static de.maishai.typedast.Util.TypedExpressionUtil.getKindOfExpression;
public class TypedDoWhile implements TypedStatement {
private TypedBlock typedBlock;
private TypedExpression cond;
private Type type;
public TypedDoWhile(Map<String, Type> localVar, TypedClass clas, DoWhile unTypedDoWhile) {
convertToTypedDoWhile(localVar, clas, unTypedDoWhile);
@ -28,6 +29,7 @@ public class TypedDoWhile implements TypedStatement {
throw new RuntimeException("Condition must be boolean");
}
typedBlock.typeCheck(localVar, clas);
this.type = Type.VOID;
return Type.VOID;
}