forked from JavaTX/JavaCompilerCore
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 java.util.Vector;
|
||||||
|
|
||||||
|
import typinferenz.ResultSet;
|
||||||
|
import typinferenz.TypeInsertPoint;
|
||||||
import typinferenz.exceptions.DebugException;
|
import typinferenz.exceptions.DebugException;
|
||||||
import typinferenz.exceptions.TypeinferenceException;
|
import typinferenz.exceptions.TypeinferenceException;
|
||||||
import mycompiler.myclass.Class;
|
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.
|
if(!this.getParent().equals(equal.getParent()))return false; //auch das Elternelement überprüfen.
|
||||||
return true;
|
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 sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||||
import typinferenz.ConstraintsSet;
|
import typinferenz.ConstraintsSet;
|
||||||
import typinferenz.JavaCodeResult;
|
import typinferenz.JavaCodeResult;
|
||||||
import typinferenz.OderConstraint;
|
import typinferenz.OderConstraint;
|
||||||
import typinferenz.ResultSet;
|
import typinferenz.ResultSet;
|
||||||
|
import typinferenz.TypeInsertPoint;
|
||||||
import typinferenz.Typeable;
|
import typinferenz.Typeable;
|
||||||
import typinferenz.UndConstraint;
|
import typinferenz.UndConstraint;
|
||||||
import typinferenz.FunN;
|
import typinferenz.FunN;
|
||||||
@ -1358,5 +1360,6 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
|||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -277,6 +277,14 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL
|
|||||||
return this.declid;
|
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
|
// ino.end
|
||||||
|
@ -748,8 +748,6 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
|||||||
public void setGenericParameter(Vector<GenericTypeVar> params) {
|
public void setGenericParameter(Vector<GenericTypeVar> params) {
|
||||||
this.genericMethodParameters = params;
|
this.genericMethodParameters = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -115,6 +115,19 @@ public class TypeinferenceResultSet
|
|||||||
*/
|
*/
|
||||||
public Vector<TypeInsertSet> getTypeInsertionPoints(){
|
public Vector<TypeInsertSet> getTypeInsertionPoints(){
|
||||||
Vector<TypeInsertSet> ret = new Vector<TypeInsertSet>();
|
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(Pair p : constraints){
|
||||||
for(TypePlaceholder tph : p.getTypePlaceholder()){
|
for(TypePlaceholder tph : p.getTypePlaceholder()){
|
||||||
//Alle TypeInsertPoints dieses TPH ermitteln:
|
//Alle TypeInsertPoints dieses TPH ermitteln:
|
||||||
|
Loading…
Reference in New Issue
Block a user