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; private final boolean specializedFunN;
public TypeToDescriptor(){ this(false); } public TypeToDescriptor(){ this(true); }
public TypeToDescriptor(boolean specializedFunN) { this.specializedFunN = specializedFunN; } 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> { public class TypeToSignature implements TypeVisitor<String> {
private List<GenericsGeneratorResult> constraints; 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(boolean specializedFunN) { this(new ArrayList<>(), specializedFunN); }
public TypeToSignature(List<GenericsGeneratorResult> constraints) { 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.constraints = constraints;
this.specializedFunN = specializedFunN; this.superFunN = superFunN;
} }
@Override @Override
public String visit(RefType refType) { public String visit(RefType refType) {
if(refType.getName().toString().equals("void")) if(refType.getName().toString().equals("void"))
return "V"; return "V";
if (refType.getName().toString().matches("Fun\\d+\\$\\$") && specializedFunN){ if (refType.getName().toString().matches("Fun\\d+\\$\\$") && !superFunN){
FunNUtilities funNUtilities = FunNGenerator.getInstance(); FunNUtilities funNUtilities = FunNGenerator.getInstance();
return funNUtilities.getSpecializedSignature(funNUtilities.getArguments(refType.getParaList()), funNUtilities.getReturnType(refType.getParaList())); 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;}; //f = x -> {return x + x;};
m(f, x) { m(f, x) {
x = f.apply(x+x); x = f.apply(x+x);
} }
} }