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; FunN f;
//ToDo refactor with code for FunN underneath //ToDo refactor with code for FunN underneath
ASTToIntermediate converter = new ASTToIntermediate(); 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 List<IntermediateInnerType> arguments = lambdaExpression.params
.getFormalparalist() .getFormalparalist()
.stream() .stream()

View File

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