forked from JavaTX/JavaCompilerCore
Refactoring der Bytecodegenerierung und Anpassung von Kommentaren.
This commit is contained in:
parent
0e363cfae3
commit
d8bdcf854c
@ -592,28 +592,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
this.lamCounter++;
|
||||
|
||||
String typeErasure = createDescriptorWithTypeErasure(lambdaExpression);
|
||||
//ByteCodeForFunNGenerator.generateBCForFunN(lambdaExpression, typeErasure,path); //old
|
||||
//ToDo Etienne: umbauen
|
||||
//ToDo Refactor
|
||||
/*
|
||||
FunN f;
|
||||
ASTToIntermediate converter = new ASTToIntermediate();
|
||||
//Fehler in return Typ
|
||||
IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(resolver.resolve(lambdaExpression.getReturnType()));
|
||||
List<IntermediateInnerType> arguments = lambdaExpression.params
|
||||
.getFormalparalist()
|
||||
.stream()
|
||||
.map(FormalParameter::getType)
|
||||
.map(resolver::resolve)
|
||||
.map(converter::convert)
|
||||
.filter(t -> t instanceof IntermediateInnerType)
|
||||
.map(t -> (IntermediateInnerType) t)
|
||||
.collect(Collectors.toList());//ToDo
|
||||
f = new FunN(arguments, returnType);
|
||||
FunN.writeClassFile(f.getSuperClassName(), f.getSuperBytecode(), path);
|
||||
FunN.writeClassFile(f.getClassName(), f.getBytecode(), path);
|
||||
*/
|
||||
///*
|
||||
//ToDo Etienne: Double Check
|
||||
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(lambdaExpression.getReturnType());
|
||||
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = lambdaExpression
|
||||
.params
|
||||
@ -623,12 +602,11 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
.map(resolver::resolve)
|
||||
.collect(Collectors.toList());
|
||||
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
||||
byte[] superBytecode = funNUtilities.generateSuperBytecode(argumentTypes.size());
|
||||
byte[] specializedBytecode = funNUtilities.generateSpecializedBytecode(argumentTypes, returnType);
|
||||
FunNUtilities.writeClassFile(funNUtilities.getSuperClassName(argumentTypes.size()), superBytecode, path);
|
||||
FunNUtilities.writeClassFile(funNUtilities.getSpecializedClassName(argumentTypes, returnType), specializedBytecode, path);
|
||||
//*/
|
||||
//ToDo Etienne: umbauen end
|
||||
FunNUtilities.writeClassFile(funNUtilities.getSuperClassName(argumentTypes.size()),
|
||||
funNUtilities.generateSuperBytecode(argumentTypes.size()), path);
|
||||
FunNUtilities.writeClassFile(funNUtilities.getSpecializedClassName(argumentTypes, returnType),
|
||||
funNUtilities.generateSpecializedBytecode(argumentTypes, returnType), path);
|
||||
|
||||
Lambda lam = new Lambda(lambdaExpression);
|
||||
String lamDesc = lam.accept(new DescriptorToString(resultSet));
|
||||
// Call site, which, when invoked, returns an instance of the functional
|
||||
@ -850,26 +828,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
} else if(!helper.isInCurrPkg(clazz)){
|
||||
if(clazz.contains(CONSTANTS.$$)) {
|
||||
mDesc = helper.getDescriptorOfApplyMethod(methCallType);
|
||||
//helper.generateBCForFunN(mDesc); //old
|
||||
//ToDo Etienne: Refactor
|
||||
/*
|
||||
FunN f;
|
||||
ASTToIntermediate converter = new ASTToIntermediate();
|
||||
IntermediateInnerType returnType = (IntermediateInnerType) converter.convert(resolver.resolve(methodCall.getType()));
|
||||
List<IntermediateInnerType> arguments = methodCall
|
||||
.argTypes
|
||||
.stream()
|
||||
.map(resolver::resolve)
|
||||
.map(converter::convert)
|
||||
.filter(t -> t instanceof IntermediateInnerType)
|
||||
.map(t -> (IntermediateInnerType) t)
|
||||
.collect(Collectors.toList());//ToDo
|
||||
f = new FunN(arguments, returnType);
|
||||
|
||||
FunN.writeClassFile(f.getSuperClassName(), f.getSuperBytecode(), path);
|
||||
FunN.writeClassFile(f.getClassName(), f.getBytecode(), path);
|
||||
*/
|
||||
///*
|
||||
//ToDo Etienne: Double Check
|
||||
RefTypeOrTPHOrWildcardOrGeneric returnType = resolver.resolve(methodCall.getType());
|
||||
List<RefTypeOrTPHOrWildcardOrGeneric> argumentTypes = methodCall
|
||||
.argTypes
|
||||
@ -877,13 +836,10 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
.map(resolver::resolve)
|
||||
.collect(Collectors.toList());
|
||||
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
||||
byte[] superBytecode = funNUtilities.generateSuperBytecode(argumentTypes.size());
|
||||
byte[] specializedBytecode = funNUtilities.generateSpecializedBytecode(argumentTypes, returnType);
|
||||
FunNUtilities.writeClassFile(funNUtilities.getSuperClassName(argumentTypes.size()), superBytecode, path);
|
||||
FunNUtilities.writeClassFile(funNUtilities.getSpecializedClassName(argumentTypes, returnType), specializedBytecode, path);
|
||||
//*/
|
||||
//ToDo Etienne End
|
||||
// mDesc = helper.generateBCForFunN(methCallType,typesOfParams);
|
||||
FunNUtilities.writeClassFile(funNUtilities.getSuperClassName(argumentTypes.size()),
|
||||
funNUtilities.generateSuperBytecode(argumentTypes.size()), path);
|
||||
FunNUtilities.writeClassFile(funNUtilities.getSpecializedClassName(argumentTypes, returnType),
|
||||
funNUtilities.generateSpecializedBytecode(argumentTypes, returnType), path);
|
||||
}else {
|
||||
try {
|
||||
cLoader2 = new DirectoryClassLoader(path, classLoader);
|
||||
|
@ -8,7 +8,6 @@ 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+\\$\\$") && refType.getParaList().size() > 0) {
|
||||
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
||||
return funNUtilities.getSpecializedDescriptor(funNUtilities.getArguments(refType.getParaList()), funNUtilities.getReturnType(refType.getParaList()));
|
||||
|
@ -31,4 +31,6 @@ public interface FunNUtilities {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ public class TypeToSignature implements TypeVisitor<String> {
|
||||
public String visit(RefType refType) {
|
||||
if(refType.getName().toString().equals("void"))
|
||||
return "V";
|
||||
//ToDo Etienne: check if it works
|
||||
if (refType.getName().toString().matches("Fun\\d+\\$\\$") && refType.getParaList().size() > 0){
|
||||
FunNUtilities funNUtilities = FunNGenerator.getInstance();
|
||||
return funNUtilities.getSpecializedSignature(funNUtilities.getArguments(refType.getParaList()), funNUtilities.getReturnType(refType.getParaList()));
|
||||
|
Loading…
Reference in New Issue
Block a user