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