Don't pass useless closure parameter to JetTypeMapper
It should always be recorded in BindingContext
This commit is contained in:
@@ -1328,7 +1328,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
ConstructorDescriptor constructorDescriptor = bindingContext.get(BindingContext.CONSTRUCTOR, expression.getObjectDeclaration());
|
||||
assert constructorDescriptor != null;
|
||||
CallableMethod constructor = typeMapper.mapToCallableMethod(constructorDescriptor, closure);
|
||||
CallableMethod constructor = typeMapper.mapToCallableMethod(constructorDescriptor);
|
||||
|
||||
Type type = bindingContext.get(ASM_TYPE, constructorDescriptor.getContainingDeclaration());
|
||||
assert type != null;
|
||||
|
||||
@@ -1137,7 +1137,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
|
||||
assert constructorDescriptor != null;
|
||||
final JvmMethodSignature constructorSignature = typeMapper.mapConstructorSignature(constructorDescriptor, closure);
|
||||
final JvmMethodSignature constructorSignature = typeMapper.mapConstructorSignature(constructorDescriptor);
|
||||
|
||||
functionCodegen.generateMethod(null, constructorSignature, constructorDescriptor, constructorContext,
|
||||
new FunctionGenerationStrategy.CodegenBased<ConstructorDescriptor>(state, constructorDescriptor) {
|
||||
@@ -1157,7 +1157,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
functionCodegen.generateDefaultIfNeeded(constructorContext, constructorSignature, constructorDescriptor,
|
||||
OwnerKind.IMPLEMENTATION, DefaultParameterValueLoader.DEFAULT);
|
||||
|
||||
CallableMethod callableMethod = typeMapper.mapToCallableMethod(constructorDescriptor, closure);
|
||||
CallableMethod callableMethod = typeMapper.mapToCallableMethod(constructorDescriptor);
|
||||
FunctionCodegen.generateConstructorWithoutParametersIfNeeded(state, callableMethod, constructorDescriptor, v);
|
||||
|
||||
if (isClassObject(descriptor)) {
|
||||
@@ -1537,7 +1537,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
iv.load(2, Type.INT_TYPE);
|
||||
}
|
||||
|
||||
CallableMethod method = typeMapper.mapToCallableMethod(constructorDescriptor, context.closure);
|
||||
CallableMethod method = typeMapper.mapToCallableMethod(constructorDescriptor);
|
||||
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
bindingContext.get(BindingContext.RESOLVED_CALL, ((JetCallElement) superCall).getCalleeExpression());
|
||||
@@ -1546,12 +1546,12 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
//noinspection SuspiciousMethodCalls
|
||||
CalculatedClosure closureForSuper = bindingContext.get(CLOSURE, superConstructor.getContainingDeclaration());
|
||||
CallableMethod superCallable = typeMapper.mapToCallableMethod(superConstructor, closureForSuper);
|
||||
|
||||
if (closureForSuper != null && closureForSuper.getCaptureThis() != null) {
|
||||
iv.load(((ConstructorFrameMap)codegen.myFrameMap).getOuterThisIndex(), OBJECT_TYPE);
|
||||
iv.load(((ConstructorFrameMap) codegen.myFrameMap).getOuterThisIndex(), OBJECT_TYPE);
|
||||
}
|
||||
|
||||
CallableMethod superCallable = typeMapper.mapToCallableMethod(superConstructor);
|
||||
|
||||
if (isAnonymousObject(descriptor) && superCall instanceof JetDelegatorToSuperCall) {
|
||||
int nextVar = findFirstSuperArgument(method);
|
||||
for (Type t : superCallable.getSignature().getAsmMethod().getArgumentTypes()) {
|
||||
|
||||
@@ -755,12 +755,6 @@ public class JetTypeMapper extends BindingTraceAware {
|
||||
|
||||
@NotNull
|
||||
public JvmMethodSignature mapConstructorSignature(@NotNull ConstructorDescriptor descriptor) {
|
||||
return mapConstructorSignature(descriptor, bindingContext.get(CodegenBinding.CLOSURE, descriptor.getContainingDeclaration()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JvmMethodSignature mapConstructorSignature(@NotNull ConstructorDescriptor descriptor, @Nullable CalculatedClosure closure) {
|
||||
|
||||
BothSignatureWriter signatureWriter = new BothSignatureWriter(BothSignatureWriter.Mode.METHOD, true);
|
||||
|
||||
// constructor type parmeters are fake
|
||||
@@ -768,6 +762,8 @@ public class JetTypeMapper extends BindingTraceAware {
|
||||
|
||||
signatureWriter.writeParametersStart();
|
||||
|
||||
CalculatedClosure closure = bindingContext.get(CodegenBinding.CLOSURE, descriptor.getContainingDeclaration());
|
||||
|
||||
ClassDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
||||
ClassDescriptor captureThis = getExpectedThisObjectForConstructorCall(descriptor, closure);
|
||||
if (captureThis != null) {
|
||||
@@ -867,12 +863,7 @@ public class JetTypeMapper extends BindingTraceAware {
|
||||
|
||||
@NotNull
|
||||
public CallableMethod mapToCallableMethod(@NotNull ConstructorDescriptor descriptor) {
|
||||
return mapToCallableMethod(descriptor, bindingContext.get(CodegenBinding.CLOSURE, descriptor.getContainingDeclaration()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CallableMethod mapToCallableMethod(@NotNull ConstructorDescriptor descriptor, @Nullable CalculatedClosure closure) {
|
||||
JvmMethodSignature method = mapConstructorSignature(descriptor, closure);
|
||||
JvmMethodSignature method = mapConstructorSignature(descriptor);
|
||||
ClassDescriptor container = descriptor.getContainingDeclaration();
|
||||
Type owner = mapClass(container);
|
||||
if (owner.getSort() != Type.OBJECT) {
|
||||
|
||||
Reference in New Issue
Block a user