Do not wrap callable references when a special option is enabled

This commit is contained in:
Alexander Udalov
2015-11-06 00:33:13 +03:00
parent 1576160390
commit 75bb15a9fc
2 changed files with 6 additions and 2 deletions
@@ -260,7 +260,9 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
} }
if (functionReferenceTarget != null) { if (functionReferenceTarget != null) {
v.invokestatic(REFLECTION, "function", Type.getMethodDescriptor(K_FUNCTION, FUNCTION_REFERENCE), false); if (!"true".equalsIgnoreCase(System.getProperty("kotlin.jvm.optimize.callable.references"))) {
v.invokestatic(REFLECTION, "function", Type.getMethodDescriptor(K_FUNCTION, FUNCTION_REFERENCE), false);
}
} }
return Unit.INSTANCE$; return Unit.INSTANCE$;
@@ -90,7 +90,9 @@ public class PropertyReferenceCodegen(
// TODO: ImplementationBodyCodegen.markLineNumberForSyntheticFunction? // TODO: ImplementationBodyCodegen.markLineNumberForSyntheticFunction?
override fun generateBody() { override fun generateBody() {
generateConstInstance(asmType, wrapperMethod.getReturnType()) { iv -> generateConstInstance(asmType, wrapperMethod.getReturnType()) { iv ->
iv.invokestatic(REFLECTION, wrapperMethod.getName(), wrapperMethod.getDescriptor(), false) if (!"true".equals(System.getProperty("kotlin.jvm.optimize.callable.references"), ignoreCase = true)) {
iv.invokestatic(REFLECTION, wrapperMethod.getName(), wrapperMethod.getDescriptor(), false)
}
} }
generateMethod("property reference init", 0, method("<init>", Type.VOID_TYPE)) { generateMethod("property reference init", 0, method("<init>", Type.VOID_TYPE)) {