Minor, split IMPL_CLASS_NAME_FOR_CALLABLE to two slices
This commit is contained in:
@@ -174,7 +174,7 @@ public class FunctionCodegen {
|
||||
|
||||
String implClassName = CodegenContextUtil.getImplementationClassShortName(owner);
|
||||
if (implClassName != null) {
|
||||
v.getSerializationBindings().put(IMPL_CLASS_NAME_FOR_CALLABLE, functionDescriptor, implClassName);
|
||||
v.getSerializationBindings().put(METHOD_IMPL_CLASS_NAME, functionDescriptor, implClassName);
|
||||
}
|
||||
if (CodegenContextUtil.isImplClassOwner(owner)) {
|
||||
v.getSerializationBindings().put(METHOD_FOR_FUNCTION, functionDescriptor, asmMethod);
|
||||
|
||||
@@ -112,7 +112,7 @@ public class PropertyCodegen {
|
||||
|
||||
String implClassName = CodegenContextUtil.getImplementationClassShortName(context);
|
||||
if (implClassName != null) {
|
||||
v.getSerializationBindings().put(IMPL_CLASS_NAME_FOR_CALLABLE, descriptor, implClassName);
|
||||
v.getSerializationBindings().put(PROPERTY_IMPL_CLASS_NAME, descriptor, implClassName);
|
||||
}
|
||||
|
||||
if (CodegenContextUtil.isImplClassOwner(context)) {
|
||||
@@ -267,7 +267,7 @@ public class PropertyCodegen {
|
||||
}
|
||||
else {
|
||||
Type tImplType = typeMapper.mapDefaultImpls((ClassDescriptor) context.getContextDescriptor());
|
||||
v.getSerializationBindings().put(IMPL_CLASS_NAME_FOR_CALLABLE, descriptor, shortNameByAsmType(tImplType));
|
||||
v.getSerializationBindings().put(PROPERTY_IMPL_CLASS_NAME, descriptor, shortNameByAsmType(tImplType));
|
||||
}
|
||||
|
||||
if (kind != OwnerKind.DEFAULT_IMPLS) {
|
||||
|
||||
+3
-2
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.codegen.serialization;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
|
||||
@@ -37,7 +36,9 @@ public final class JvmSerializationBindings {
|
||||
SerializationMappingSlice.create();
|
||||
public static final SerializationMappingSlice<PropertyDescriptor, Method> SYNTHETIC_METHOD_FOR_PROPERTY =
|
||||
SerializationMappingSlice.create();
|
||||
public static final SerializationMappingSlice<CallableMemberDescriptor, String> IMPL_CLASS_NAME_FOR_CALLABLE =
|
||||
public static final SerializationMappingSlice<FunctionDescriptor, String> METHOD_IMPL_CLASS_NAME =
|
||||
SerializationMappingSlice.create();
|
||||
public static final SerializationMappingSlice<PropertyDescriptor, String> PROPERTY_IMPL_CLASS_NAME =
|
||||
SerializationMappingSlice.create();
|
||||
public static final SerializationMappingSetSlice<PropertyDescriptor> STATIC_FIELD_IN_OUTER_CLASS =
|
||||
SerializationMappingSetSlice.create();
|
||||
|
||||
+7
-17
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen.serialization;
|
||||
|
||||
import com.google.protobuf.MessageLite;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -99,8 +98,6 @@ public class JvmSerializerExtension extends SerializerExtension {
|
||||
proto.setExtension(JvmProtoBuf.constructorSignature, signature);
|
||||
}
|
||||
}
|
||||
|
||||
saveImplClassName(descriptor, proto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,7 +110,10 @@ public class JvmSerializerExtension extends SerializerExtension {
|
||||
}
|
||||
}
|
||||
|
||||
saveImplClassName(descriptor, proto);
|
||||
String name = bindings.get(METHOD_IMPL_CLASS_NAME, descriptor);
|
||||
if (name != null) {
|
||||
proto.setExtension(JvmProtoBuf.methodImplClassName, stringTable.getStringIndex(name));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,19 +151,9 @@ public class JvmSerializerExtension extends SerializerExtension {
|
||||
|
||||
proto.setExtension(JvmProtoBuf.propertySignature, signature);
|
||||
|
||||
saveImplClassName(descriptor, proto);
|
||||
}
|
||||
|
||||
private void saveImplClassName(@NotNull CallableMemberDescriptor callable, @NotNull MessageLite.Builder proto) {
|
||||
String name = bindings.get(IMPL_CLASS_NAME_FOR_CALLABLE, callable);
|
||||
if (name == null) return;
|
||||
|
||||
int index = stringTable.getStringIndex(name);
|
||||
if (proto instanceof ProtoBuf.Function.Builder) {
|
||||
((ProtoBuf.Function.Builder) proto).setExtension(JvmProtoBuf.methodImplClassName, index);
|
||||
}
|
||||
else if (proto instanceof ProtoBuf.Property.Builder) {
|
||||
((ProtoBuf.Property.Builder) proto).setExtension(JvmProtoBuf.propertyImplClassName, index);
|
||||
String name = bindings.get(PROPERTY_IMPL_CLASS_NAME, descriptor);
|
||||
if (name != null) {
|
||||
proto.setExtension(JvmProtoBuf.propertyImplClassName, stringTable.getStringIndex(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user