use of org.jetbrains.kotlin.codegen.AccessorForPropertyDescriptor in project kotlin by JetBrains.
the class FieldOwnerContext method getFieldName.
@NotNull
public String getFieldName(@NotNull PropertyDescriptor possiblySubstitutedDescriptor, boolean isDelegated) {
if (possiblySubstitutedDescriptor instanceof AccessorForPropertyDescriptor) {
possiblySubstitutedDescriptor = ((AccessorForPropertyDescriptor) possiblySubstitutedDescriptor).getCalleeDescriptor();
}
PropertyDescriptor descriptor = possiblySubstitutedDescriptor.getOriginal();
assert descriptor.getKind().isReal() : "Only declared properties can have backing fields: " + descriptor;
String defaultPropertyName = KotlinTypeMapper.mapDefaultFieldName(descriptor, isDelegated);
Map<PropertyDescriptor, String> descriptor2Name = fieldNames.get(defaultPropertyName);
if (descriptor2Name == null) {
descriptor2Name = new HashMap<PropertyDescriptor, String>();
fieldNames.put(defaultPropertyName, descriptor2Name);
}
String actualName = descriptor2Name.get(descriptor);
if (actualName != null)
return actualName;
String newName = descriptor2Name.isEmpty() || AnnotationUtilKt.hasJvmFieldAnnotation(descriptor) ? defaultPropertyName : defaultPropertyName + "$" + descriptor2Name.size();
descriptor2Name.put(descriptor, newName);
return newName;
}
Aggregations