Source:
<code>public void visitClosureReference(ClosureReference closureReference) { GoloFunction target = closureReference.getTarget(); final boolean isVarArgs = target.isVarargs(); final int arity = (isVarArgs) ? target.getArity() - 1 : target.getArity(); final int syntheticCount = closureReference.getTarget().getSyntheticParameterCount(); methodVisitor.visitInvokeDynamicInsn( target.getName(), methodType(FunctionReference.class).toMethodDescriptorString(), CLOSUREREF_HANDLE, klass, (Integer) arity, (Boolean) isVarArgs); if (syntheticCount > 0) { methodVisitor.visitMethodInsn( INVOKEVIRTUAL, "gololang/FunctionReference", "handle", "()Ljava/lang/invoke/MethodHandle;", false); String[] refs = closureReference.getCapturedReferenceNames().toArray(new String[syntheticCount]); loadInteger(methodVisitor, 0); loadInteger(methodVisitor, syntheticCount); methodVisitor.visitTypeInsn(ANEWARRAY, "java/lang/Object"); ReferenceTable table = context.referenceTableStack.peek(); for (int i = 0; i < syntheticCount; i++) { methodVisitor.visitInsn(DUP); loadInteger(methodVisitor, i); methodVisitor.visitVarInsn(ALOAD, table.get(refs[i]).getIndex()); methodVisitor.visitInsn(AASTORE); } methodVisitor.visitMethodInsn( INVOKESTATIC, "java/lang/invoke/MethodHandles", "insertArguments", "(Ljava/lang/invoke/MethodHandle;I[Ljava/lang/Object;)Ljava/lang/invoke/MethodHandle;", false); methodVisitor.visitTypeInsn(NEW, "gololang/FunctionReference"); methodVisitor.visitInsn(DUP_X1); methodVisitor.visitInsn(SWAP); <START> methodVisitor.visitMethodInsn( <END> INVOKESPECIAL, "gololang/FunctionReference", "<init>", "(Ljava/lang/invoke/MethodHandle;)V", false); if (isVarArgs) { methodVisitor.visitLdcInsn(Type.getType(Object[].class)); methodVisitor.visitMethodInsn( INVOKEVIRTUAL, "gololang/FunctionReference", "asVarargsCollector", "(Ljava/lang/Class;)Lgololang/FunctionReference;", false); } } }</code><technical_language>indy invocation</technical_language>

Target:
public void visitClosureReference(ClosureReference closureReference) { GoloFunction target = closureReference.getTarget(); final boolean isVarArgs = target.isVarargs(); final int arity = (isVarArgs) ? target.getArity() - 1 : target.getArity(); final int syntheticCount = closureReference.getTarget().getSyntheticParameterCount(); methodVisitor.visitInvokeDynamicInsn( target.getName(), methodType(FunctionReference.class).toMethodDescriptorString(), CLOSUREREF_HANDLE, klass, (Integer) arity, (Boolean) isVarArgs); if (syntheticCount > 0) { String[] refs = closureReference.getCapturedReferenceNames().toArray(new String[syntheticCount]); loadInteger(methodVisitor, 0); loadInteger(methodVisitor, syntheticCount); methodVisitor.visitTypeInsn(ANEWARRAY, "java/lang/Object"); ReferenceTable table = context.referenceTableStack.peek(); for (int i = 0; i < syntheticCount; i++) { methodVisitor.visitInsn(DUP); loadInteger(methodVisitor, i); methodVisitor.visitVarInsn(ALOAD, table.get(refs[i]).getIndex()); methodVisitor.visitInsn(AASTORE); } methodVisitor.visitMethodInsn( INVOKEVIRTUAL, "gololang/FunctionReference", "insertArguments", "(I[Ljava/lang/Object;)Lgololang/FunctionReference;", false); if (isVarArgs) { methodVisitor.visitLdcInsn(Type.getType(Object[].class)); methodVisitor.visitMethodInsn( INVOKEVIRTUAL, "gololang/FunctionReference", "asVarargsCollector", "(Ljava/lang/Class;)Lgololang/FunctionReference;", false); } } }