[JS IR] Fix export of nested enums

Merge-request: KT-MR-5916
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>

^KT-51211 fixed
This commit is contained in:
Ilya Goncharov
2022-03-18 09:45:14 +00:00
committed by Space
parent 644db43e67
commit adad0b4628
6 changed files with 71 additions and 8 deletions
@@ -61,18 +61,18 @@ class ExportModelGenerator(
return when (candidate) {
is IrSimpleFunction -> exportFunction(candidate)
is IrProperty -> exportProperty(candidate)
is IrClass -> {
if (candidate.isEnumClass) {
exportEnumClass(candidate)
} else {
exportClass(candidate)
}
}
is IrClass -> exportClass(candidate)
is IrField -> null
else -> error("Can't export declaration $candidate")
}
}
private fun exportClass(candidate: IrClass) = if (candidate.isEnumClass) {
exportEnumClass(candidate)
} else {
exportOrdinaryClass(candidate)
}
private fun exportFunction(function: IrSimpleFunction): ExportedDeclaration? {
return when (val exportability = functionExportability(function)) {
is Exportability.NotNeeded -> null
@@ -221,7 +221,7 @@ class ExportModelGenerator(
return Exportability.Allowed
}
private fun exportClass(
private fun exportOrdinaryClass(
klass: IrClass
): ExportedDeclaration? {
when (val exportability = classExportability(klass)) {