Verbesserung der Generierung von FunN-Typen.
Lambda Expressions noch fehlerhaft.
This commit is contained in:
parent
15c05e5cba
commit
bcf56e6bdd
@ -592,11 +592,12 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
public void visit(LambdaExpression lambdaExpression) {
|
||||
this.lamCounter++;
|
||||
|
||||
//ToDo Etienne: umbauen
|
||||
String typeErasure = createDescriptorWithTypeErasure(lambdaExpression);
|
||||
|
||||
ByteCodeForFunNGenerator.generateBCForFunN(lambdaExpression, typeErasure,path);
|
||||
|
||||
|
||||
//ToDo Etienne: umbauen
|
||||
Lambda lam = new Lambda(lambdaExpression);
|
||||
String lamDesc = lam.accept(new DescriptorToString(resultSet));
|
||||
// Call site, which, when invoked, returns an instance of the functional
|
||||
@ -822,7 +823,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
//helper.generateBCForFunN(mDesc);
|
||||
FunN f;
|
||||
ASTToIntermediate converter = new ASTToIntermediate();
|
||||
IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(methodCall.receiver.getType());
|
||||
IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(resolver.resolve(methodCall.receiver.getType()));
|
||||
if(methodCall
|
||||
.arglist
|
||||
.getArguments().size() > 0){
|
||||
@ -831,6 +832,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
.getArguments()
|
||||
.stream()
|
||||
.map(TypableStatement::getType)
|
||||
.map(resolver::resolve)
|
||||
.map(converter::convert)
|
||||
.filter(t -> t instanceof IntermediateInnerType)
|
||||
.map(t -> (IntermediateInnerType) t)
|
||||
|
@ -153,6 +153,7 @@ public class DescriptorToString implements DescriptorVisitor, CONSTANTS {
|
||||
return desc;
|
||||
}
|
||||
|
||||
//ToDo Etienne: ändern
|
||||
@Override
|
||||
public String visit(Lambda lambdaExpression) {
|
||||
String desc = "(";
|
||||
|
@ -25,4 +25,9 @@ public class Resolver {
|
||||
public String getResolvedType(RefTypeOrTPHOrWildcardOrGeneric type) {
|
||||
return resultSet.resolveType(type).resolvedType.acceptTV(new TypeToDescriptor());
|
||||
}
|
||||
|
||||
//ToDo Etienne: Check ob benötigt
|
||||
public RefTypeOrTPHOrWildcardOrGeneric resolve(RefTypeOrTPHOrWildcardOrGeneric type) {
|
||||
return resultSet.resolveType(type).resolvedType;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.dhbwstuttgart.intermediate.convert;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.utilities.Resolver;
|
||||
import de.dhbwstuttgart.exceptions.NotImplementedException;
|
||||
import de.dhbwstuttgart.intermediate.generation.FunN;
|
||||
import de.dhbwstuttgart.intermediate.types.*;
|
||||
@ -18,6 +19,7 @@ public class ASTToIntermediate {
|
||||
System.out.println(originalType.getParaList().size());
|
||||
|
||||
if (originalType.getName().toString().matches("Fun\\d+\\$\\$")){
|
||||
if(originalType.getParaList().size() == 0) throw new RuntimeException("Incorrect FunN Type: No params are defined!");
|
||||
ASTToIntermediate converter = new ASTToIntermediate();
|
||||
List<RefTypeOrTPHOrWildcardOrGeneric> parameters = originalType.getParaList();
|
||||
IntermediateInnerType returnType = (IntermediateInnerType) convert(parameters.get(parameters.size() - 1));
|
||||
|
Loading…
Reference in New Issue
Block a user