Fix FunNGenerator

This commit is contained in:
Vic Nightfall 2022-11-27 13:22:47 +01:00
parent 8806d1462c
commit b63d1bcf73
2 changed files with 2 additions and 2 deletions

View File

@ -71,13 +71,14 @@ public class FunNGenerator {
for (TargetType typeArgument : parameters) { for (TargetType typeArgument : parameters) {
//ToDo Etienne: Refactor //ToDo Etienne: Refactor
if (typeArgument instanceof TargetGenericType generic){ if (typeArgument instanceof TargetGenericType generic){
if(genericSignature.contains(generic.name())) continue; //if(genericSignature.contains(generic.name())) continue;
genericSignature += String.format("%s:%s", generic.name(), applyDescriptor(generic)); genericSignature += String.format("%s:%s", generic.name(), applyDescriptor(generic));
containsGeneric = true; containsGeneric = true;
} }
} }
genericSignature += ">"; genericSignature += ">";
if (containsGeneric) funNClassSignature.insert(0, genericSignature); if (containsGeneric) funNClassSignature.insert(0, genericSignature);
System.out.println(funNClassSignature.toString());
ClassWriter classWriter = new ClassWriter(0); ClassWriter classWriter = new ClassWriter(0);
classWriter.visit(bytecodeVersion, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, getSpecializedClassName(argumentTypes, returnType), funNClassSignature.toString(), objectSuperType, new String[]{getSuperClassName(argumentTypes.size())}); classWriter.visit(bytecodeVersion, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, getSpecializedClassName(argumentTypes, returnType), funNClassSignature.toString(), objectSuperType, new String[]{getSuperClassName(argumentTypes.size())});

View File

@ -675,7 +675,6 @@ public class ASTToTargetAST {
var params = refType.getParaList().stream().map(ASTToTargetAST.this::convert).toList(); var params = refType.getParaList().stream().map(ASTToTargetAST.this::convert).toList();
if (name.matches("Fun\\d+\\$\\$")) { // TODO This seems like a bad idea if (name.matches("Fun\\d+\\$\\$")) { // TODO This seems like a bad idea
var className = FunNGenerator.getSpecializedClassName(FunNGenerator.getArguments(params), FunNGenerator.getReturnType(params)); var className = FunNGenerator.getSpecializedClassName(FunNGenerator.getArguments(params), FunNGenerator.getReturnType(params));
System.out.println(className);
if (!usedFunNSuperTypes.contains(params.size())) { if (!usedFunNSuperTypes.contains(params.size())) {
usedFunNSuperTypes.add(params.size()); usedFunNSuperTypes.add(params.size());
var code = FunNGenerator.generateSuperBytecode(params.size() - 1); var code = FunNGenerator.generateSuperBytecode(params.size() - 1);