forked from JavaTX/JavaCompilerCore
Kleine Anpassungen
This commit is contained in:
parent
66da1d2638
commit
f20b978b14
3
bin/.gitignore
vendored
3
bin/.gitignore
vendored
@ -1,5 +1,2 @@
|
|||||||
/de/
|
/de/
|
||||||
/plugindevelopment/
|
/plugindevelopment/
|
||||||
=======
|
|
||||||
/syntaxTree/
|
|
||||||
/bytecode/
|
|
||||||
|
@ -698,7 +698,7 @@ public class SourceFile
|
|||||||
retValue = Unify.unify(pairs, finiteClosure);
|
retValue = Unify.unify(pairs, finiteClosure);
|
||||||
return retValue;};
|
return retValue;};
|
||||||
oderConstraints.filterWrongConstraints(unifier);
|
oderConstraints.filterWrongConstraints(unifier);
|
||||||
//oderConstraints.unifyUndConstraints(unifier);
|
oderConstraints.unifyUndConstraints(unifier);
|
||||||
typinferenzLog.debug("Übriggebliebene Konstraints:\n"+oderConstraints+"\n", Section.TYPEINFERENCE);
|
typinferenzLog.debug("Übriggebliebene Konstraints:\n"+oderConstraints+"\n", Section.TYPEINFERENCE);
|
||||||
//Die Constraints in Pair's umwandeln (Karthesisches Produkt bilden):
|
//Die Constraints in Pair's umwandeln (Karthesisches Produkt bilden):
|
||||||
Vector<Vector<Pair>> xConstraints = new Vector<Vector<Pair>>();// = oderConstraints.getConstraints();
|
Vector<Vector<Pair>> xConstraints = new Vector<Vector<Pair>>();// = oderConstraints.getConstraints();
|
||||||
|
@ -18,6 +18,7 @@ import de.dhbwstuttgart.syntaxtree.type.DoubleType;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
|
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
@ -150,9 +151,15 @@ public class LambdaExpression extends Expr{
|
|||||||
//ArgumentAssumptions + assumptions ergeben die Assumptions für die Statements innerhalb des Lambda-Bodys:
|
//ArgumentAssumptions + assumptions ergeben die Assumptions für die Statements innerhalb des Lambda-Bodys:
|
||||||
ret.add(method_body.TYPEStmt(ArgumentAssumptions.add(assumptions))); //Es gibt die LambdaExpression nur mit einem Block als Method Body, nicht mit einer einzelnen Expression
|
ret.add(method_body.TYPEStmt(ArgumentAssumptions.add(assumptions))); //Es gibt die LambdaExpression nur mit einem Block als Method Body, nicht mit einer einzelnen Expression
|
||||||
|
|
||||||
|
//Die Typen innerhalb von FunN anpassen:
|
||||||
|
Vector<Type> superParamTypes = new Vector<>();
|
||||||
|
for(Type pT : paramTypes){
|
||||||
|
superParamTypes.add(new SuperWildcardType(pT.getOffset(), pT));
|
||||||
|
}
|
||||||
Type retType = method_body.getType();
|
Type retType = method_body.getType();
|
||||||
ExtendsWildcardType extRetType = new ExtendsWildcardType(retType.getOffset(), retType);
|
ExtendsWildcardType extRetType = new ExtendsWildcardType(retType.getOffset(), retType);
|
||||||
ret.add(new SingleConstraint(new FunN(extRetType, paramTypes).TYPE(assumptions, this),this.getType().TYPE(assumptions, this)));
|
|
||||||
|
ret.add(new SingleConstraint(new FunN(extRetType, superParamTypes).TYPE(assumptions, this),this.getType().TYPE(assumptions, this)));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class ExtendsWildcardType extends WildcardType implements ITypeContainer,
|
|||||||
{
|
{
|
||||||
if(obj instanceof ExtendsWildcardType)
|
if(obj instanceof ExtendsWildcardType)
|
||||||
{
|
{
|
||||||
return this.extendsType.equals(((ExtendsWildcardType)obj).get_ExtendsType());
|
return super.equals(obj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -56,22 +56,6 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
|
|||||||
return new SuperWildcardType(getOffset(), superType.clone());
|
return new SuperWildcardType(getOffset(), superType.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Author: Arne Lüdtke<br/>
|
|
||||||
* Vergleicht mit einem anderen Objekt.
|
|
||||||
* @param obj - Object to compare.
|
|
||||||
*/
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if(obj instanceof SuperWildcardType)
|
|
||||||
{
|
|
||||||
return this.superType.equals(((SuperWildcardType)obj).get_SuperType());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Arne Lüdtke<br/>
|
* Author: Arne Lüdtke<br/>
|
||||||
@ -129,4 +113,21 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
|
|||||||
return new JavaCodeResult("? super " + this.superType.printJavaCode(result));
|
return new JavaCodeResult("? super " + this.superType.printJavaCode(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Arne Lüdtke<br/>
|
||||||
|
* Vergleicht mit einem anderen Objekt.
|
||||||
|
* @param obj - Object to compare.
|
||||||
|
*/
|
||||||
|
public boolean equals(Object obj)
|
||||||
|
{
|
||||||
|
if(obj instanceof SuperWildcardType)
|
||||||
|
{
|
||||||
|
return super.equals(obj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,24 +42,6 @@ public class WildcardType extends Type{
|
|||||||
return new WildcardType(this.getParent(), getOffset());
|
return new WildcardType(this.getParent(), getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Author: Arne Lüdtke<br/>
|
|
||||||
* Vergleicht mit einem anderen Objekt.
|
|
||||||
* @param obj - Object to compare.
|
|
||||||
*/
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
//Luar 06-11-29 If Block erstellt, falls weitere Einschränkungen notwendig werden.
|
|
||||||
if(obj instanceof WildcardType && !(obj instanceof SuperWildcardType || obj instanceof ExtendsWildcardType))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Arne Lüdtke<br/>
|
* Author: Arne Lüdtke<br/>
|
||||||
* Gibt die passende FreshWildcardType Klasse zurück.
|
* Gibt die passende FreshWildcardType Klasse zurück.
|
||||||
@ -93,4 +75,18 @@ public class WildcardType extends Type{
|
|||||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object obj)
|
||||||
|
{
|
||||||
|
if(obj instanceof WildcardType)
|
||||||
|
{
|
||||||
|
return ((WildcardType)obj).GetWildcardType().equals(this.GetWildcardType());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user