[JS IR] Export nested objects
Companion objects are exported as ParentClass.Companion. Companion object's members are not exposed to its parent class — one must reference the companion object explicitly if they want to access its members. #KT-43783 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
862f8cdad8
commit
be999564b1
+7
-1
@@ -86,9 +86,15 @@ class ExportModelToJsStatements(
|
||||
)
|
||||
).makeStmt()
|
||||
|
||||
// These are only used when exporting secondary constructors annotated with @JsName
|
||||
val staticFunctions = declaration.members.filter { it is ExportedFunction && it.isStatic }
|
||||
|
||||
val staticsExport = (staticFunctions + declaration.nestedClasses)
|
||||
// Nested objects are exported as static properties
|
||||
val staticProperties = declaration.members.mapNotNull {
|
||||
(it as? ExportedProperty)?.takeIf { it.isStatic }
|
||||
}
|
||||
|
||||
val staticsExport = (staticFunctions + staticProperties + declaration.nestedClasses)
|
||||
.flatMap { generateDeclarationExport(it, newNameSpace) }
|
||||
|
||||
listOf(klassExport) + staticsExport
|
||||
|
||||
Reference in New Issue
Block a user