Constraints generieren. Fehler beheben

This commit is contained in:
JanUlrich 2017-03-15 16:54:43 +01:00
parent 5fab817154
commit 92c284a04b
5 changed files with 8 additions and 19 deletions

View File

@ -23,18 +23,12 @@ import de.dhbwstuttgart.syntaxtree.statement.Block;
public class Method extends Field implements IItemWithOffset
{
private Block block;
private ParameterList parameterlist = new ParameterList(null, new NullToken());
private ParameterList parameterlist = new ParameterList(new ArrayList<>(), new NullToken());
private ExceptionList exceptionlist;
private String name;
private List<String> types_in_parameterlist = new ArrayList<>();
private int modifiers;
private ParameterList parameterList;
public Method(String name, RefTypeOrTPH returnType, int modifiers, ParameterList parameterList, Block block,
GenericDeclarationList gtvDeclarations, Token offset) {
super(name, returnType, modifiers, offset);
this.name = name;
this.parameterlist = parameterList;
this.block = block;
}
@ -47,6 +41,6 @@ public class Method extends Field implements IItemWithOffset
}
public ParameterList getParameterList() {
return parameterList;
return parameterlist;
}
}

View File

@ -38,6 +38,7 @@ public class MethodCall extends Statement
methodConstraints.addConstraint(m.getArgTypes().get(i),
arglist.getArguments().get(i).getType());
}
overloading.addConstraint(methodConstraints);
}
ret.add(overloading);
return ret;

View File

@ -1,16 +1,13 @@
package de.dhbwstuttgart.typeinference;
import java.util.ArrayList;
import java.util.Set;
import java.util.TreeSet;
import java.util.Vector;
import java.util.*;
public class OderConstraint extends OderMenge<Pair>{
private Set<UndConstraint> oderConstraintPairs;
public OderConstraint(){
oderConstraintPairs = new TreeSet<>();
oderConstraintPairs = new HashSet<>();
}

View File

@ -1,9 +1,6 @@
package de.dhbwstuttgart.typeinference;
import java.util.Collection;
import java.util.Set;
import java.util.TreeSet;
import java.util.Vector;
import java.util.*;
import de.dhbwstuttgart.exceptions.DebugException;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
@ -16,7 +13,7 @@ import de.dhbwstuttgart.typeinference.unify.Unifikationsalgorithmus;
*/
public class UndConstraint extends UndMenge<Pair> {
Set<EinzelElement<Pair>> set = new TreeSet<>();
Set<EinzelElement<Pair>> set = new HashSet<>();
@Override
public Set<? extends KomplexeMenge<Pair>> getSet() {

View File

@ -1,6 +1,6 @@
class Methods {
mt4(a,b,c) { return a.add(b).sub(c) ; }
mt4(a,b,c) { return a.mt3(b).mt3(c) ; }
mt3(a) {return a.add(); }
}