IR: add IrClass.hasEnumEntries

This flag will be used on JVM to determine whether or not to generate
external enum entries mappings ("$EntriesMappings") classes. Note that
from the frontend's point of view, every enum has `entries`, so for
backend purposes we have to reach out to the underlying deserialized
data to read the flag from the metadata.
This commit is contained in:
Alexander Udalov
2023-08-17 12:54:59 +02:00
committed by Space Team
parent db31f1f926
commit c33c918bd4
19 changed files with 68 additions and 10 deletions
@@ -52,9 +52,11 @@ class DeserializedClassDescriptor(
VersionRequirementTable.create(classProto.versionRequirementTable), metadataVersion
)
val hasEnumEntriesMetadataFlag: Boolean = Flags.HAS_ENUM_ENTRIES.get(classProto.flags)
private val staticScope =
if (kind == ClassKind.ENUM_CLASS) {
val enumEntriesCanBeUsed = Flags.HAS_ENUM_ENTRIES.get(classProto.flags) ||
val enumEntriesCanBeUsed = hasEnumEntriesMetadataFlag ||
c.components.enumEntriesDeserializationSupport.canSynthesizeEnumEntries() == true
StaticScopeForKotlinEnum(c.storageManager, this, enumEntriesCanBeUsed)
} else {