Make EnumEntries implementation eager

* Addresses the recent design changes of the corresponding language feature
* Also rework JS/Wasm enumEntries implementation with the function that accepts array instead of fabric function


^KT-57318


Co-authored-by: Artem Kobzar <Artem.Kobzar@jetbrains.com>

Merge-request: KT-MR-9204
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
This commit is contained in:
Vsevolod Tolstopyatov
2023-03-20 10:18:28 +00:00
committed by Space Team
parent 7a79de6d16
commit 33d13474c5
7 changed files with 25 additions and 96 deletions
@@ -258,7 +258,7 @@ private val enumEntryCreateGetInstancesFunsLoweringPhase = makeWasmModulePhase(
)
private val enumSyntheticFunsLoweringPhase = makeWasmModulePhase(
{ EnumSyntheticFunctionsAndPropertiesLowering(it, syntheticFieldsShouldBeReinitialized = true) },
::EnumSyntheticFunctionsAndPropertiesLowering,
name = "EnumSyntheticFunctionsAndPropertiesLowering",
description = "Implement `valueOf`, `values` and `entries`",
prerequisite = setOf(
@@ -108,7 +108,7 @@ class WasmSymbols(
val enumEntries = getIrClass(FqName.fromSegments(listOf("kotlin", "enums", "EnumEntries")))
val createEnumEntries = findFunctions(enumsInternalPackage.memberScope, Name.identifier("enumEntries"))
.find { it.valueParameters.firstOrNull()?.type?.isFunctionType == true }
.find { it.valueParameters.firstOrNull()?.type?.isFunctionType == false }
.let { symbolTable.referenceSimpleFunction(it!!) }
val enumValueOfIntrinsic = getInternalFunction("enumValueOfIntrinsic")