Alle Tests der Bytecode-Generierung sind nun auf grün mit den Spezialisierungen der FunN Typen.

Bytecode muss noch manuell überprüft werden, ob überall korrekt!
This commit is contained in:
Etienne Zink 2022-03-28 11:56:14 +02:00
parent 4522aeff36
commit fedf33a006
3 changed files with 6 additions and 16 deletions

View File

@ -598,7 +598,8 @@ public class BytecodeGenMethod implements StatementVisitor {
FunN f;
//ToDo refactor with code for FunN underneath
ASTToIntermediate converter = new ASTToIntermediate();
IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(lambdaExpression.getReturnType());
//Fehler in return Typ
IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(resolver.resolve(lambdaExpression.getReturnType()));
List<IntermediateInnerType> arguments = lambdaExpression.params
.getFormalparalist()
.stream()

View File

@ -14,7 +14,7 @@ public class TypeToDescriptor implements TypeVisitor<String>{
@Override
public String visit(RefType refType) {
//ToDo Etienne: check if it works
if (refType.getName().toString().matches("Fun\\d+\\$\\$")){
if (refType.getName().toString().matches("Fun\\d+\\$\\$")) {
String descriptor = new ASTToIntermediate().convert(refType).getDescriptor();
return descriptor.substring(1, descriptor.length() - 1);
}

View File

@ -3,9 +3,7 @@ package de.dhbwstuttgart.intermediate.convert;
import de.dhbwstuttgart.exceptions.NotImplementedException;
import de.dhbwstuttgart.intermediate.generation.FunN;
import de.dhbwstuttgart.intermediate.types.*;
import de.dhbwstuttgart.parser.scope.JavaClassName;
import de.dhbwstuttgart.syntaxtree.type.*;
import org.objectweb.asm.Type;
import java.util.List;
import java.util.stream.Collectors;
@ -39,8 +37,6 @@ public class ASTToIntermediate {
.collect(Collectors.toList()));
}
//ToDo abklären: darf hier kein <T extends Integer> stehen? da hier kein Typparameter existiert
public IntermediateGenericType convert(GenericRefType originalType){
//no typ argument for e.g. <T extends Integer> is present in the definition of GenericRefType
return new IntermediateGenericType(originalType.getParsedName());
@ -60,17 +56,10 @@ public class ASTToIntermediate {
return new IntermediateExtendsWildcard((IntermediateInnerType) innerType);
}
/*
public IntermediateWildcard convert(){
//thows RuntimeException because in the AST is no typ defined which represents a normal wildcard
throw new NotImplementedException("There is no conversion defined for this type.");
}
*/
//ToDo Etienne: check if it works
public IntermediateRefType convert(TypePlaceholder originalType){
//ToDo zu Generic nachher
return new IntermediateRefType(new JavaClassName(Type.getInternalName(Object.class)));
public IntermediateGenericType convert(TypePlaceholder originalType){
//ToDo muss zu einem Generic werden
return new IntermediateGenericType(originalType.getName());
}
public IntermediateType convert(RefTypeOrTPHOrWildcardOrGeneric originalType){