forked from JavaTX/JavaCompilerCore
Fun umbenannt und Argumente umgedreht
This commit is contained in:
parent
5c797a44a1
commit
9575afd0b4
@ -17,6 +17,8 @@ import de.dhbwstuttgart.bytecode.descriptor.DescriptorToString;
|
||||
import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
|
||||
import de.dhbwstuttgart.bytecode.signature.Signature;
|
||||
import de.dhbwstuttgart.bytecode.signature.TypeToString;
|
||||
import de.dhbwstuttgart.bytecode.utilities.NormalConstructor;
|
||||
import de.dhbwstuttgart.bytecode.utilities.NormalMethod;
|
||||
import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal;
|
||||
import de.dhbwstuttgart.syntaxtree.*;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Literal;
|
||||
|
@ -31,6 +31,10 @@ import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
|
||||
import de.dhbwstuttgart.bytecode.signature.Signature;
|
||||
import de.dhbwstuttgart.bytecode.signature.TypeToSignature;
|
||||
import de.dhbwstuttgart.bytecode.signature.TypeToString;
|
||||
import de.dhbwstuttgart.bytecode.utilities.KindOfLambda;
|
||||
import de.dhbwstuttgart.bytecode.utilities.Lambda;
|
||||
import de.dhbwstuttgart.bytecode.utilities.MethodFromMethodCall;
|
||||
import de.dhbwstuttgart.bytecode.utilities.SamMethod;
|
||||
import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal;
|
||||
import de.dhbwstuttgart.syntaxtree.FormalParameter;
|
||||
import de.dhbwstuttgart.syntaxtree.Method;
|
||||
@ -566,7 +570,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
methSig.visitReturnType().visitTypeVariable("R");
|
||||
// ")"+lam.getReturn.getBounds
|
||||
Signature sig = new Signature(lambdaExpression, numberOfParams);
|
||||
String name = "Fun" + numberOfParams;
|
||||
String name = "Fun" + numberOfParams + "$$";
|
||||
classWriter.visit(Opcodes.V1_8, Opcodes.ACC_INTERFACE + Opcodes.ACC_ABSTRACT, name, sig.toString(),
|
||||
Type.getInternalName(Object.class), null);
|
||||
MethodVisitor mvApply = classWriter.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT, "apply", methDesc,
|
||||
|
@ -2,12 +2,12 @@ package de.dhbwstuttgart.bytecode.descriptor;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.Lambda;
|
||||
import de.dhbwstuttgart.bytecode.MethodFromMethodCall;
|
||||
import de.dhbwstuttgart.bytecode.NormalConstructor;
|
||||
import de.dhbwstuttgart.bytecode.NormalMethod;
|
||||
import de.dhbwstuttgart.bytecode.SamMethod;
|
||||
import de.dhbwstuttgart.bytecode.signature.TypeToSignature;
|
||||
import de.dhbwstuttgart.bytecode.utilities.Lambda;
|
||||
import de.dhbwstuttgart.bytecode.utilities.MethodFromMethodCall;
|
||||
import de.dhbwstuttgart.bytecode.utilities.NormalConstructor;
|
||||
import de.dhbwstuttgart.bytecode.utilities.NormalMethod;
|
||||
import de.dhbwstuttgart.bytecode.utilities.SamMethod;
|
||||
import de.dhbwstuttgart.syntaxtree.FormalParameter;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Expression;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package de.dhbwstuttgart.bytecode.descriptor;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.Lambda;
|
||||
import de.dhbwstuttgart.bytecode.MethodFromMethodCall;
|
||||
import de.dhbwstuttgart.bytecode.NormalConstructor;
|
||||
import de.dhbwstuttgart.bytecode.NormalMethod;
|
||||
import de.dhbwstuttgart.bytecode.SamMethod;
|
||||
import de.dhbwstuttgart.bytecode.utilities.Lambda;
|
||||
import de.dhbwstuttgart.bytecode.utilities.MethodFromMethodCall;
|
||||
import de.dhbwstuttgart.bytecode.utilities.NormalConstructor;
|
||||
import de.dhbwstuttgart.bytecode.utilities.NormalMethod;
|
||||
import de.dhbwstuttgart.bytecode.utilities.SamMethod;
|
||||
|
||||
public interface DescriptorVisitor {
|
||||
public String visit(NormalMethod method);
|
||||
|
@ -59,9 +59,6 @@ public class Signature {
|
||||
|
||||
private void createSignatureForFunN(LambdaExpression lambdaExpression, int numberOfParams) {
|
||||
|
||||
sw.visitFormalTypeParameter("R");
|
||||
// getBounds vom Return-Type
|
||||
sw.visitClassBound().visitClassType(Type.getInternalName(Object.class));
|
||||
sw.visitClassBound().visitEnd();
|
||||
for(int i = 0;i<numberOfParams;i++) {
|
||||
int j = i+1;
|
||||
@ -70,6 +67,11 @@ public class Signature {
|
||||
sw.visitClassBound().visitClassType(Type.getInternalName(Object.class));
|
||||
sw.visitClassBound().visitEnd();
|
||||
}
|
||||
|
||||
sw.visitFormalTypeParameter("R");
|
||||
// getBounds vom Return-Type
|
||||
sw.visitClassBound().visitClassType(Type.getInternalName(Object.class));
|
||||
sw.visitClassBound().visitEnd();
|
||||
// TODO: prüfe ob Return-Type = void,
|
||||
sw.visitSuperclass().visitClassType(Type.getInternalName(Object.class));;
|
||||
sw.visitEnd();
|
||||
|
@ -1,4 +1,4 @@
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
package de.dhbwstuttgart.bytecode.utilities;
|
||||
|
||||
import de.dhbwstuttgart.exceptions.NotImplementedException;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.*;
|
@ -1,4 +1,4 @@
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
package de.dhbwstuttgart.bytecode.utilities;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.descriptor.DescriptorVisitor;
|
||||
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
@ -1,4 +1,4 @@
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
package de.dhbwstuttgart.bytecode.utilities;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
package de.dhbwstuttgart.bytecode.utilities;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
package de.dhbwstuttgart.bytecode.utilities;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
package de.dhbwstuttgart.bytecode.utilities;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -154,7 +154,7 @@ public class JavaTXCompiler {
|
||||
((PlaceholderType)x.getRhsType()).disableWildcardtable();
|
||||
}
|
||||
}
|
||||
return x;HIER DIE JEWEILS RECHT BZW. LINKE SEITE AUF GLEICHE VARIANZ SETZEN WIE DIE JEWEILS ANDERE SEITE
|
||||
return x;//HIER DIE JEWEILS RECHT BZW. LINKE SEITE AUF GLEICHE VARIANZ SETZEN WIE DIE JEWEILS ANDERE SEITE
|
||||
}).collect(Collectors.toCollection(HashSet::new));
|
||||
Set<Set<UnifyPair>> result = unify.unifySequential(xConsSet, finiteClosure, logFile);
|
||||
//Set<Set<UnifyPair>> result = unify.unify(xConsSet, finiteClosure);
|
||||
|
@ -904,7 +904,7 @@ public class StatementGenerator {
|
||||
funNParams.add(TypePlaceholder.fresh(expression.getStart())));
|
||||
RefTypeOrTPHOrWildcardOrGeneric lambdaType = TypePlaceholder.fresh(expression.getStart());
|
||||
//RefType lambdaType = new RefType(reg.getName("Fun"+params.getFormalparalist().size()),
|
||||
//funNParams, name.getStart());
|
||||
//funNParams, name.getStart());
|
||||
return new LambdaExpression(lambdaType, params, block, expression.getStart());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user