This commit is contained in:
JanUlrich 2014-02-22 05:43:20 +01:00
parent b891ad4580
commit a39a9273a1
3 changed files with 22 additions and 3 deletions

View File

@ -9,6 +9,8 @@ import java.util.Vector;
import typinferenz.JavaCodeResult; import typinferenz.JavaCodeResult;
import typinferenz.ResultSet; import typinferenz.ResultSet;
import typinferenz.TypeInsertPoint;
import typinferenz.TypeInsertable;
import mycompiler.MyCompiler; import mycompiler.MyCompiler;
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
import mycompiler.mytypereconstruction.replacementlistener.IReplaceTypeEventProvider; import mycompiler.mytypereconstruction.replacementlistener.IReplaceTypeEventProvider;
@ -508,6 +510,16 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
return equalType.printJavaCode(resultSet); return equalType.printJavaCode(resultSet);
} }
public Vector<TypeInsertPoint> getTypeInsertPoints(ResultSet result) {
Vector<TypeInsertPoint> ret = new Vector<TypeInsertPoint>();
for(ITypeReplacementListener ti : this.m_ReplacementListeners){
if(ti instanceof TypeInsertable){
new TypeInsertPoint(this, ti, result.getTypeEqualTo(this));
}
}
return ret;
}
} }
// ino.end // ino.end

View File

@ -113,16 +113,17 @@ public class TypeinferenceResultSet
} }
/** /**
* Berechnet alle möglichen Punkte zum Einsetzen eines Typs im Quelltext * Berechnet alle möglichen Punkte zum Einsetzen eines Typs im Quelltext an der Stelle dieses TypePlaceholders
* @return * @return
*/ */
public Vector<TypeInsertPoint> getTypeInsertionPoints(){ public Vector<TypeInsertPoint> getTypeInsertionPoints(){
Vector<TypeInsertPoint> ret = new Vector<TypeInsertPoint>();
for(Pair p : constraints){ for(Pair p : constraints){
for(TypePlaceholder tph : p.getTypePlaceholder()){ for(TypePlaceholder tph : p.getTypePlaceholder()){
ret.addAll(tph.getTypeInsertPoints(this.unifiedConstraints));
} }
} }
return null; return ret;
} }
} }

View File

@ -1,5 +1,11 @@
package typinferenz; package typinferenz;
import mycompiler.mytype.*;
public class TypeInsertPoint { public class TypeInsertPoint {
public TypeInsertPoint(TypePlaceholder tph, TypeInsertable insertPoint, Type insertType){
}
} }