Korrektur in TypeToDescriptor und TypeToSignature -> Ohne Angabe im Deskriptor wird automatisch angenommen es soll eine spezialisierte Signatur erstellt werden.

This commit is contained in:
Etienne Zink 2022-03-29 15:58:10 +02:00
parent 9444ee38d6
commit 7012010462
3 changed files with 8 additions and 8 deletions

View File

@ -8,7 +8,7 @@ public class TypeToDescriptor implements TypeVisitor<String>{
private final boolean specializedFunN;
public TypeToDescriptor(){ this(false); }
public TypeToDescriptor(){ this(true); }
public TypeToDescriptor(boolean specializedFunN) { this.specializedFunN = specializedFunN; }

View File

@ -19,26 +19,26 @@ import de.dhbwstuttgart.syntaxtree.type.TypeVisitor;
public class TypeToSignature implements TypeVisitor<String> {
private List<GenericsGeneratorResult> constraints;
private final boolean specializedFunN;
private final boolean superFunN;
public TypeToSignature() { this(new ArrayList<>(), false); }
public TypeToSignature() { this(new ArrayList<>(), true); }
public TypeToSignature(boolean specializedFunN) { this(new ArrayList<>(), specializedFunN); }
public TypeToSignature(List<GenericsGeneratorResult> constraints) {
this(constraints, false);
this(constraints, true);
}
public TypeToSignature(List<GenericsGeneratorResult> constraints, boolean specializedFunN){
public TypeToSignature(List<GenericsGeneratorResult> constraints, boolean superFunN){
this.constraints = constraints;
this.specializedFunN = specializedFunN;
this.superFunN = superFunN;
}
@Override
public String visit(RefType refType) {
if(refType.getName().toString().equals("void"))
return "V";
if (refType.getName().toString().matches("Fun\\d+\\$\\$") && specializedFunN){
if (refType.getName().toString().matches("Fun\\d+\\$\\$") && !superFunN){
FunNUtilities funNUtilities = FunNGenerator.getInstance();
return funNUtilities.getSpecializedSignature(funNUtilities.getArguments(refType.getParaList()), funNUtilities.getReturnType(refType.getParaList()));
}

View File

@ -11,6 +11,6 @@ public class OLFun {
//f = x -> {return x + x;};
m(f, x) {
x = f.apply(x+x);
x = f.apply(x+x);
}
}