Преглед изворни кода

Some small changes on Generated Lambdas

The interfaces now are annotated with FunctionalInterface
CapturedParameters might work now
kindlich пре 6 година
родитељ
комит
bcceba4543
No known key found for this signature in database

+ 1
- 0
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler/CompilerUtils.java Прегледај датотеку

@@ -151,6 +151,7 @@ public class CompilerUtils {
151 151
 
152 152
     private static void createLambdaInterface(FunctionHeader header, String name) {
153 153
         ClassWriter ifaceWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
154
+        ifaceWriter.visitAnnotation("java/lang/FunctionalInterface", true).visitEnd();
154 155
         ifaceWriter.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT, name, null, "java/lang/Object", null);
155 156
 
156 157
         ifaceWriter.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_ABSTRACT, "accept", calcDesc(header, false), calcSign(header, false), null).visitEnd();

+ 1
- 1
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler/JavaCapturedExpressionVisitor.java Прегледај датотеку

@@ -17,7 +17,7 @@ public class JavaCapturedExpressionVisitor implements CapturedExpressionVisitor<
17 17
 
18 18
     @Override
19 19
     public Void visitCapturedParameter(CapturedParameterExpression expression) {
20
-        return null;
20
+        return new GetFunctionParameterExpression(expression.position, expression.parameter).accept(expressionVisitor);
21 21
     }
22 22
 
23 23
     @Override

Loading…
Откажи
Сачувај