forked from JavaTX/JavaCompilerCore
Filter entfernen
This commit is contained in:
parent
5f428894ea
commit
bb165e007d
@ -715,19 +715,13 @@ public class SourceFile
|
||||
retValue = Unify.unify(pairs, finiteClosure);
|
||||
return retValue;};
|
||||
//oderConstraints.filterWrongConstraints(unifier);
|
||||
oderConstraints.unifyUndConstraints(unifier);
|
||||
|
||||
//oderConstraints.unifyUndConstraints(unifier); //rausgeworfen für Tests (08.12.2015)
|
||||
|
||||
typinferenzLog.debug("Ãbriggebliebene Konstraints:\n"+oderConstraints+"\n", Section.TYPEINFERENCE);
|
||||
//Die Constraints in Pair's umwandeln (Karthesisches Produkt bilden):
|
||||
Menge<Menge<Pair>> xConstraints = oderConstraints.cartesianProduct();
|
||||
/*
|
||||
for(Menge<UndConstraint> uC : oderConstraints.getConstraints()){ //mit dem getConstraints-Aufruf wird das Karthesische Produkt erzeugt.
|
||||
Menge<Pair> cons = new Menge<Pair>();
|
||||
for(UndConstraint undCons:uC){
|
||||
cons.addAll(undCons.getConstraintPairs());
|
||||
}
|
||||
xConstraints.add(cons);
|
||||
}
|
||||
*/
|
||||
|
||||
typinferenzLog.debug("Karthesisches Produkt der Constraints: "+xConstraints, Section.TYPEINFERENCE);
|
||||
|
||||
finiteClosure.generateFullyNamedTypes(globalAssumptions);
|
||||
@ -750,53 +744,9 @@ public class SourceFile
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//Alle Generischen Typvariablen in TPH umwandeln:
|
||||
HashMap<GenericTypeVar,TypePlaceholder> gtv2tph = new HashMap<GenericTypeVar,TypePlaceholder>();
|
||||
for(Pair pair : constraints){
|
||||
if(pair.TA1 instanceof GenericTypeVar){
|
||||
TypePlaceholder tph = gtv2tph.get(pair.TA1);
|
||||
if(tph == null){
|
||||
tph = TypePlaceholder.fresh();
|
||||
gtv2tph.put((GenericTypeVar)pair.TA1, tph);
|
||||
}
|
||||
pair.TA1 = tph;
|
||||
}
|
||||
if(pair.TA2 instanceof GenericTypeVar){
|
||||
TypePlaceholder tph = gtv2tph.get(pair.TA2);
|
||||
if(tph == null){
|
||||
tph = TypePlaceholder.fresh();
|
||||
gtv2tph.put((GenericTypeVar)pair.TA2, tph);
|
||||
}
|
||||
pair.TA2 = tph;
|
||||
}
|
||||
}
|
||||
*/
|
||||
//Erst die Unifizierung erstellen:
|
||||
Menge<Pair> constraintsClone = (Menge<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 de.dhbwstuttgart.syntaxtree.type.Void)){
|
||||
Type replaceType = null;
|
||||
replaceType = globalAssumptions.getTypeFor((RefType)t, null);
|
||||
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 de.dhbwstuttgart.syntaxtree.type.Void)){
|
||||
Type replaceType = null;
|
||||
replaceType = globalAssumptions.getTypeFor((RefType)t, null);
|
||||
if(!(replaceType == null))p.TA2 = replaceType;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//IDEE: Man bildet Zusammenhangskomponenten von Paaren, die gemeinsame Variablen haben
|
||||
// und unifizert nur die Zusammenhangskomponenten in Schritten 1 - 5
|
||||
|
||||
@ -842,28 +792,6 @@ public class SourceFile
|
||||
Menge<Menge<Pair>> cardprodret_start = new Menge<>();
|
||||
cardprodret_start.add(new Menge<Pair>());
|
||||
|
||||
//cart. Produkt mit kopieren
|
||||
//Menge<Menge<Pair>> unifyResult = vecunifyResult.stream().reduce(cardprodret_start, (x, y) -> {
|
||||
//Menge<Menge<Pair>> cardprodret= new Menge<>();
|
||||
//if (y.size() > 0) {
|
||||
////System.out.println(y);
|
||||
//Menge<Menge<Pair>> cardprodretold = x;
|
||||
//cardprodret = new Menge<>();
|
||||
//for(int j = 0; j < cardprodretold.size(); j++) {
|
||||
//for (int k = 0; k < y.size(); k++){
|
||||
//Menge<Pair> help;
|
||||
//if (y.size() == 1) help = cardprodretold.elementAt(j); //bei einem hinzuzufuegenden Element muss nicht kopiert werden
|
||||
//else help = Unify.copyMengePair(cardprodretold.elementAt(j));
|
||||
//help.addAll(y.elementAt(k));
|
||||
//cardprodret.add(help);
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
//else
|
||||
//return new Menge<>(); //kein unifiziertes Ergebnis, damit wird das Geseamtergebnis []
|
||||
//return cardprodret;
|
||||
//});
|
||||
|
||||
//cart. Produkt mit Linkverschiebung
|
||||
Menge<Menge<Pair>> unifyResult = vecunifyResult.stream().reduce(cardprodret_start, (x, y) -> {
|
||||
Menge<Menge<Pair>> cardprodret= new Menge<>();
|
||||
@ -885,34 +813,9 @@ public class SourceFile
|
||||
return cardprodret;
|
||||
});
|
||||
|
||||
//Menge<Menge<Pair>> unifyResult = Unify.unify(constraintsClone, finiteClosure);
|
||||
//Dann den Ergebnissen anfügen
|
||||
result.addAll(unifyResult);
|
||||
|
||||
// Debugoutput:Menge<Menge<Pair>>
|
||||
|
||||
//typinferenzLog.debug("Unifiziertes Ergebnis: "+result, Section.TYPEINFERENCE);
|
||||
|
||||
/*
|
||||
// Prüfe ob eindeutige Lösung:
|
||||
if(result.size()>1 && !Unify.hasSolvedForm(result.elementAt(0))){
|
||||
|
||||
typinferenzLog.debug("Keine eindeutige Lösung!");
|
||||
|
||||
}else if(result.size()>1){
|
||||
|
||||
//Replace TPH:
|
||||
for(Pair res : result.elementAt(0)){
|
||||
if(res.OperatorEqual()){
|
||||
if(res.TA1 instanceof TypePlaceholder)((TypePlaceholder)res.TA1).fireReplaceTypeEvent(new CReplaceTypeEvent(res.TA1, res.TA2));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//typinferenzLog.debug();
|
||||
//typinferenzLog.debug(supportData.getFiniteClosure());
|
||||
//typinferenzLog.debug("Typinformationen: \n"+this.getTypeInformation(this.getMethodList(), fieldInitializers));
|
||||
|
||||
typinferenzLog.debug("\nJavaFiles:\n", Section.TYPEINFERENCE);
|
||||
|
||||
//typinferenzLog.debug(this.printJavaCode(new ResultSet(new Menge<Pair>())));
|
||||
|
Loading…
Reference in New Issue
Block a user