[JS IR] Possibility to use export for nested inside object
[JS IR] Fix test data after master rebase [JS IR] Use stdlib's listOfNotNull [JS IR] Possibility to use export for nested inside object - Add tests for such cases Merge-request: KT-MR-4883 ^KT-49363 fixed
This commit is contained in:
+19
-1
@@ -24,7 +24,25 @@ class B {
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
object MyObject {
|
||||
class A {
|
||||
fun valueA() = "OK"
|
||||
}
|
||||
class B {
|
||||
fun valueB() = "OK"
|
||||
}
|
||||
class C {
|
||||
fun valueC() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
function box() {
|
||||
return new this["export_nested_class"].B.Foo().bar("K");
|
||||
if (new this["export_nested_class"].B.Foo().bar("K") != "OK") return "fail 1";
|
||||
if (new this["export_nested_class"].MyObject.A().valueA() != "OK") return "fail 2";
|
||||
if (new this["export_nested_class"].MyObject.B().valueB() != "OK") return "fail 3";
|
||||
if (new this["export_nested_class"].MyObject.C().valueC() != "OK") return "fail 4";
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -37,6 +37,19 @@ sealed class MyEnum(val name: String) {
|
||||
object C: MyEnum("C")
|
||||
}
|
||||
|
||||
@JsExport
|
||||
object MyObject {
|
||||
object A {
|
||||
fun valueA() = "OK"
|
||||
}
|
||||
object B {
|
||||
fun valueB() = "OK"
|
||||
}
|
||||
object C {
|
||||
fun valueC() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
|
||||
function box() {
|
||||
@@ -54,5 +67,9 @@ function box() {
|
||||
if (nestedObjectExport.MyEnum.B.name != 'B') return 'MyEnum.B failure';
|
||||
if (nestedObjectExport.MyEnum.C.name != 'C') return 'MyEnum.C failure';
|
||||
|
||||
if (nestedObjectExport.MyObject.A.valueA() != "OK") return 'MyObject.A failure';
|
||||
if (nestedObjectExport.MyObject.B.valueB() != "OK") return 'MyObject.B failure';
|
||||
if (nestedObjectExport.MyObject.C.valueC() != "OK") return 'MyObject.C failure';
|
||||
|
||||
return 'OK';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user