mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 17:08:03 +00:00
Add Type to TypedBlock
This commit is contained in:
parent
34a20668b6
commit
f40318f905
@ -17,11 +17,17 @@ import java.util.Map;
|
|||||||
public class TypedBlock implements TypedNode {
|
public class TypedBlock implements TypedNode {
|
||||||
private List<TypedLocalVariable> vars = new ArrayList<>();
|
private List<TypedLocalVariable> vars = new ArrayList<>();
|
||||||
private List<TypedStatement> stmts = new ArrayList<>();
|
private List<TypedStatement> stmts = new ArrayList<>();
|
||||||
|
private Type type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public TypedBlock(Map<String, Type> localVar, TypedClass clas, Block unTypedBlock) {
|
public TypedBlock(Map<String, Type> localVar, TypedClass clas, Block unTypedBlock) {
|
||||||
blockToTypedBlock(localVar, clas, unTypedBlock);
|
blockToTypedBlock(localVar, clas, unTypedBlock);
|
||||||
}
|
}
|
||||||
|
public TypedBlock(List<TypedLocalVariable> vars, List<TypedStatement> stmts) {
|
||||||
|
this.vars = vars;
|
||||||
|
this.stmts = stmts;
|
||||||
|
}
|
||||||
|
|
||||||
public void blockToTypedBlock(Map<String, Type> localVar, TypedClass clas, Block unTypedBlock) {
|
public void blockToTypedBlock(Map<String, Type> localVar, TypedClass clas, Block unTypedBlock) {
|
||||||
|
|
||||||
@ -90,6 +96,7 @@ public class TypedBlock implements TypedNode {
|
|||||||
//TODO: implement this
|
//TODO: implement this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.typeCheck(localVar, clas);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,8 +111,8 @@ public class TypedBlock implements TypedNode {
|
|||||||
stmt.typeCheck(localVar, clas);
|
stmt.typeCheck(localVar, clas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type = Type.VOID;
|
||||||
return Type.VOID;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void codeGen(MethodVisitor mv, MethodContext ctx) {
|
public void codeGen(MethodVisitor mv, MethodContext ctx) {
|
||||||
|
Loading…
Reference in New Issue
Block a user