forked from JavaTX/JavaCompilerCore
Typen werden vor dem Unifizieren nochmals kontrolliert
This commit is contained in:
parent
1a655943ed
commit
6a98115361
@ -728,6 +728,27 @@ public class SourceFile
|
|||||||
*/
|
*/
|
||||||
//Erst die Unifizierung erstellen:
|
//Erst die Unifizierung erstellen:
|
||||||
Vector<Pair> constraintsClone = (Vector<Pair>)constraints.clone();
|
Vector<Pair> constraintsClone = (Vector<Pair>)constraints.clone();
|
||||||
|
|
||||||
|
//Typen kontrollieren:
|
||||||
|
for(Pair p : constraintsClone){
|
||||||
|
Type t = p.TA1;
|
||||||
|
//TypeCheck, falls es sich um einen RefType handelt:
|
||||||
|
if(t!=null && (t instanceof RefType)&&
|
||||||
|
!(t instanceof mycompiler.mytype.Void)){
|
||||||
|
Type replaceType = null;
|
||||||
|
replaceType = globalAssumptions.getTypeFor((RefType)t);
|
||||||
|
if(!(replaceType == null))p.TA1 = replaceType;
|
||||||
|
}
|
||||||
|
t = p.TA2;
|
||||||
|
//TypeCheck, falls es sich um einen RefType handelt:
|
||||||
|
if(t!=null && (t instanceof RefType)&&
|
||||||
|
!(t instanceof mycompiler.mytype.Void)){
|
||||||
|
Type replaceType = null;
|
||||||
|
replaceType = globalAssumptions.getTypeFor((RefType)t);
|
||||||
|
if(!(replaceType == null))p.TA2 = replaceType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Vector<Vector<Pair>> unifyResult = Unify.unify(constraintsClone, finiteClosure);
|
Vector<Vector<Pair>> unifyResult = Unify.unify(constraintsClone, finiteClosure);
|
||||||
//Dann den Ergebnissen anfügen
|
//Dann den Ergebnissen anfügen
|
||||||
result.addAll(unifyResult);
|
result.addAll(unifyResult);
|
||||||
|
@ -61,7 +61,9 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL
|
|||||||
if(!(object instanceof FormalParameter))return false;
|
if(!(object instanceof FormalParameter))return false;
|
||||||
FormalParameter equals = (FormalParameter)object;
|
FormalParameter equals = (FormalParameter)object;
|
||||||
if((this.type==null)!=(equals.type == null))return false;
|
if((this.type==null)!=(equals.type == null))return false;
|
||||||
if(this.type != null)return this.type.equals(equals.type);
|
if(this.type != null){
|
||||||
|
return this.type.equals(equals.type);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,6 +132,7 @@ public class TypeAssumptions {
|
|||||||
Vector<MethodAssumption> ret = new Vector<MethodAssumption>();
|
Vector<MethodAssumption> ret = new Vector<MethodAssumption>();
|
||||||
for(MethodAssumption ass : this.methodAssumptions){
|
for(MethodAssumption ass : this.methodAssumptions){
|
||||||
if(ass.getMethodName().equals(methodName) && ass.getParaCount() == parameterCount){
|
if(ass.getMethodName().equals(methodName) && ass.getParaCount() == parameterCount){
|
||||||
|
|
||||||
ret.add(ass);
|
ret.add(ass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user