Fehler in TYPE-Methode von Constructor beheben

This commit is contained in:
JanUlrich 2015-02-25 18:51:48 +01:00
parent da70abf954
commit 5455ba803e
2 changed files with 12 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
import de.dhbwstuttgart.syntaxtree.type.Void;
public class Constructor extends Method {
private Method methode;
@ -55,7 +56,8 @@ public class Constructor extends Method {
}
@Override
public ConstraintsSet TYPE(TypeAssumptions ass) {
super.setType(new RefType(this.getParentClass().getName().toString(), this, this.getOffset()));
//super.setType(this.getParentClass().getType());
super.setType(new Void(this, 0));
return super.TYPE(ass);
}
@Override

View File

@ -7,6 +7,8 @@ import de.dhbwstuttgart.syntaxtree.Field;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.statement.ArgumentList;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
public class ConstructorAssumption extends MethodAssumption{
@ -20,6 +22,13 @@ public class ConstructorAssumption extends MethodAssumption{
return super.equals(obj);
}
@Override
public Type getAssumedType() {
throw new DebugException("Eine ConstructorAssumption hat keinen Typ bzw. er ist nicht relevant");
//return this.getMethod().getParentClass().getType();
}
@Override
public String toString(){
String ret = "ConstructorAssumption: ";
ret += this.getMethodName()+"(";