Simplified code.
This commit is contained in:
@@ -111,10 +111,10 @@ public class ClosureCodegen extends GenerationStateAware {
|
|||||||
cv.visitSource(fun.getContainingFile().getName(), null);
|
cv.visitSource(fun.getContainingFile().getName(), null);
|
||||||
|
|
||||||
|
|
||||||
generateBridge(interfaceFunction, name.getInternalName(), funDescriptor, fun, cv);
|
generateBridge(interfaceFunction, funDescriptor, fun, cv);
|
||||||
generateBody(interfaceFunction.getName(), funDescriptor, cv, fun, context, expressionCodegen);
|
generateBody(interfaceFunction.getName(), funDescriptor, cv, fun, context, expressionCodegen);
|
||||||
|
|
||||||
constructor = generateConstructor(funClass, fun, cv, closure);
|
constructor = generateConstructor(superclass, fun, cv);
|
||||||
|
|
||||||
if (isConst(closure)) {
|
if (isConst(closure)) {
|
||||||
generateConstInstance(fun, cv);
|
generateConstInstance(fun, cv);
|
||||||
@@ -163,7 +163,6 @@ public class ClosureCodegen extends GenerationStateAware {
|
|||||||
|
|
||||||
private void generateBridge(
|
private void generateBridge(
|
||||||
FunctionDescriptor interfaceFunction,
|
FunctionDescriptor interfaceFunction,
|
||||||
String className,
|
|
||||||
FunctionDescriptor funDescriptor,
|
FunctionDescriptor funDescriptor,
|
||||||
JetExpression fun,
|
JetExpression fun,
|
||||||
ClassBuilder cv
|
ClassBuilder cv
|
||||||
@@ -186,7 +185,7 @@ public class ClosureCodegen extends GenerationStateAware {
|
|||||||
|
|
||||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||||
|
|
||||||
iv.load(0, Type.getObjectType(className));
|
iv.load(0, name.getAsmType());
|
||||||
|
|
||||||
ReceiverParameterDescriptor receiver = funDescriptor.getReceiverParameter();
|
ReceiverParameterDescriptor receiver = funDescriptor.getReceiverParameter();
|
||||||
int count = 1;
|
int count = 1;
|
||||||
@@ -201,7 +200,7 @@ public class ClosureCodegen extends GenerationStateAware {
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
iv.invokevirtual(className, interfaceFunction.getName().getName(), delegate.getDescriptor());
|
iv.invokevirtual(name.getInternalName(), interfaceFunction.getName().getName(), delegate.getDescriptor());
|
||||||
StackValue.onStack(delegate.getReturnType()).put(bridge.getReturnType(), iv);
|
StackValue.onStack(delegate.getReturnType()).put(bridge.getReturnType(), iv);
|
||||||
|
|
||||||
iv.areturn(bridge.getReturnType());
|
iv.areturn(bridge.getReturnType());
|
||||||
@@ -211,10 +210,9 @@ public class ClosureCodegen extends GenerationStateAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Method generateConstructor(
|
private Method generateConstructor(
|
||||||
JvmClassName funClass,
|
JvmClassName superclass,
|
||||||
JetExpression fun,
|
JetExpression fun,
|
||||||
ClassBuilder cv,
|
ClassBuilder cv
|
||||||
CalculatedClosure closure
|
|
||||||
) {
|
) {
|
||||||
List<FieldInfo> args = calculateConstructorParameters(typeMapper, bindingContext, closure, name.getAsmType());
|
List<FieldInfo> args = calculateConstructorParameters(typeMapper, bindingContext, closure, name.getAsmType());
|
||||||
|
|
||||||
@@ -230,10 +228,8 @@ public class ClosureCodegen extends GenerationStateAware {
|
|||||||
mv.visitCode();
|
mv.visitCode();
|
||||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||||
|
|
||||||
Type superAsmType = samInterface == null ? funClass.getAsmType() : OBJECT_TYPE;
|
iv.load(0, superclass.getAsmType());
|
||||||
|
iv.invokespecial(superclass.getInternalName(), "<init>", "()V");
|
||||||
iv.load(0, superAsmType);
|
|
||||||
iv.invokespecial(superAsmType.getInternalName(), "<init>", "()V");
|
|
||||||
|
|
||||||
int k = 1;
|
int k = 1;
|
||||||
for (FieldInfo fieldInfo : args) {
|
for (FieldInfo fieldInfo : args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user