[K/JS, TEST] Enable TS export tests for FIR ^KT-64421 Fixed

This commit is contained in:
Artem Kobzar
2024-02-28 16:52:27 +00:00
committed by Space Team
parent 55e61f6631
commit 6a2e785abd
13 changed files with 1872 additions and 93 deletions
@@ -303,6 +303,7 @@ class ExportModelGenerator(val context: JsIrBackendContext, val generateNamespac
specialProcessing: (IrDeclarationWithName) -> ExportedDeclaration? = { null }
): ExportedClassDeclarationsInfo {
val members = mutableListOf<ExportedDeclaration>()
val specialMembers = mutableListOf<ExportedDeclaration>()
val nestedClasses = mutableListOf<ExportedClass>()
val isImplicitlyExportedClass = klass.isJsImplicitExport()
@@ -314,7 +315,7 @@ class ExportModelGenerator(val context: JsIrBackendContext, val generateNamespac
val processingResult = specialProcessing(candidate)
if (processingResult != null) {
members.add(processingResult)
specialMembers.add(processingResult)
continue
}
@@ -362,7 +363,7 @@ class ExportModelGenerator(val context: JsIrBackendContext, val generateNamespac
}
return ExportedClassDeclarationsInfo(
members,
specialMembers + members,
nestedClasses
)
}
@@ -496,7 +497,7 @@ class ExportModelGenerator(val context: JsIrBackendContext, val generateNamespac
"ordinal" -> enumEntriesToOrdinal
.map { (_, ordinal) -> ExportedType.LiteralType.NumberLiteralType(ordinal) }
.reduce { acc: ExportedType, s: ExportedType -> ExportedType.UnionType(acc, s) }
else -> null
else -> return null
}
exportPropertyUnsafely(
candidate,
@@ -300,7 +300,8 @@ class ExportModelToTsDeclarations {
val (innerClasses, nonInnerClasses) = nestedDeclarations.partition { it.ir.isInner }
val innerClassesProperties = innerClasses.map { it.toReadonlyProperty() }
val membersString = (members + innerClassesProperties).joinToString("") { it.toTypeScript("$indent ") + "\n" }
val membersString = (members + innerClassesProperties)
.joinToString("") { it.toTypeScript("$indent ") + "\n" }
// If there are no exported constructors, add a private constructor to disable default one
val privateCtorString = if (!isInterface && !isAbstract && members.none { it is ExportedConstructor }) {