forked from JavaTX/JavaCompilerCore
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:
parent
4522aeff36
commit
fedf33a006
@ -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()
|
||||||
|
@ -14,7 +14,7 @@ public class TypeToDescriptor implements TypeVisitor<String>{
|
|||||||
@Override
|
@Override
|
||||||
public String visit(RefType refType) {
|
public String visit(RefType refType) {
|
||||||
//ToDo Etienne: check if it works
|
//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();
|
String descriptor = new ASTToIntermediate().convert(refType).getDescriptor();
|
||||||
return descriptor.substring(1, descriptor.length() - 1);
|
return descriptor.substring(1, descriptor.length() - 1);
|
||||||
}
|
}
|
||||||
|
@ -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){
|
||||||
|
Loading…
Reference in New Issue
Block a user