SyntaxTreeNode wird zum ermitteln der TIPs zusätzlich durchlaufen
This commit is contained in:
parent
183d8f43ee
commit
9aea618525
@ -2,6 +2,8 @@ package mycompiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.TypeInsertPoint;
|
||||
import typinferenz.exceptions.DebugException;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
import mycompiler.myclass.Class;
|
||||
@ -57,4 +59,12 @@ public abstract class SyntaxTreeNode {
|
||||
if(!this.getParent().equals(equal.getParent()))return false; //auch das Elternelement überprüfen.
|
||||
return true;
|
||||
}
|
||||
|
||||
public Vector<Vector<TypeInsertPoint>> getTypeInsertPoints(ResultSet result) {
|
||||
Vector<Vector<TypeInsertPoint>> ret = new Vector<Vector<TypeInsertPoint>>();
|
||||
for(SyntaxTreeNode node : this.getChildren()){
|
||||
ret.addAll(node.getTypeInsertPoints(result));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -62,11 +62,13 @@ import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
|
||||
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
import typinferenz.ConstraintsSet;
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.OderConstraint;
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.TypeInsertPoint;
|
||||
import typinferenz.Typeable;
|
||||
import typinferenz.UndConstraint;
|
||||
import typinferenz.FunN;
|
||||
@ -1358,5 +1360,6 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
// ino.end
|
||||
|
@ -277,6 +277,14 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL
|
||||
return this.declid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector<Vector<TypeInsertPoint>> getTypeInsertPoints(ResultSet result) {
|
||||
Vector<Vector<TypeInsertPoint>> ret = super.getTypeInsertPoints(result);
|
||||
if(this.getType() instanceof TypePlaceholder){
|
||||
ret.add(((TypePlaceholder)this.getType()).getTypeInsertPoints(result));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
// ino.end
|
||||
|
@ -749,7 +749,5 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
this.genericMethodParameters = params;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
// ino.end
|
||||
|
@ -115,6 +115,19 @@ public class TypeinferenceResultSet
|
||||
*/
|
||||
public Vector<TypeInsertSet> getTypeInsertionPoints(){
|
||||
Vector<TypeInsertSet> ret = new Vector<TypeInsertSet>();
|
||||
//TODO: Eigentlich sollten die TypeInsertPoints von den Elementen im Syntaxbaum erstellt werden. Momentan wird beides parallel eingesetzt
|
||||
Vector<Vector<TypeInsertPoint>> TISets = this.ownerOfResultSet.getTypeInsertPoints(this.unifiedConstraints);
|
||||
for(Vector<TypeInsertPoint> TIPs : TISets){
|
||||
TypeInsertSet toAdd = new TypeInsertSet();
|
||||
for(int i = 0; i<TIPs.size();i++){
|
||||
TypeInsertPoint tip = TIPs.elementAt(i);
|
||||
for(TypePlaceholder involvedTPH : toAdd.add(tip)){ //TIP anfügen...
|
||||
}
|
||||
}
|
||||
if(!ret.contains(toAdd))ret.add(toAdd);
|
||||
}
|
||||
|
||||
//TODO: Das Erstellen von TPI per Durchsuchen der muss abgelöst werden:
|
||||
for(Pair p : constraints){
|
||||
for(TypePlaceholder tph : p.getTypePlaceholder()){
|
||||
//Alle TypeInsertPoints dieses TPH ermitteln:
|
||||
|
Loading…
Reference in New Issue
Block a user