Fix local variables table for inline classes
This commit is contained in:
@@ -529,16 +529,18 @@ public class FunctionCodegen {
|
||||
@NotNull KotlinTypeMapper typeMapper
|
||||
) {
|
||||
ReceiverParameterDescriptor dispatchReceiver = functionDescriptor.getDispatchReceiverParameter();
|
||||
// all functions inside erased version of inline class are static, so they don't have `this` as is,
|
||||
// but functions inside wrapper class should use type of wrapper class, not the underlying type
|
||||
if (functionDescriptor instanceof ConstructorDescriptor) {
|
||||
return typeMapper.mapType(functionDescriptor);
|
||||
return typeMapper.mapTypeAsDeclaration(functionDescriptor);
|
||||
}
|
||||
else if (dispatchReceiver != null) {
|
||||
return typeMapper.mapType(dispatchReceiver.getType());
|
||||
return typeMapper.mapTypeAsDeclaration(dispatchReceiver.getType());
|
||||
}
|
||||
else if (isFunctionLiteral(functionDescriptor) ||
|
||||
isLocalFunction(functionDescriptor) ||
|
||||
isFunctionExpression(functionDescriptor)) {
|
||||
return typeMapper.mapType(context.getThisDescriptor());
|
||||
return typeMapper.mapClass(context.getThisDescriptor());
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
||||
@@ -396,12 +396,23 @@ public class KotlinTypeMapper {
|
||||
return mapType(jetType, null, TypeMappingMode.DEFAULT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Type mapTypeAsDeclaration(@NotNull KotlinType kotlinType) {
|
||||
return mapType(kotlinType, null, TypeMappingMode.CLASS_DECLARATION);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Type mapType(@NotNull CallableDescriptor descriptor) {
|
||||
//noinspection ConstantConditions
|
||||
return mapType(descriptor.getReturnType());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Type mapTypeAsDeclaration(@NotNull CallableDescriptor descriptor) {
|
||||
//noinspection ConstantConditions
|
||||
return mapTypeAsDeclaration(descriptor.getReturnType());
|
||||
}
|
||||
|
||||
public Type mapErasedInlineClass(@NotNull ClassDescriptor descriptor) {
|
||||
return Type.getObjectType(mapClass(descriptor).getInternalName() + JvmAbi.ERASED_INLINE_CLASS_SUFFIX);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user