[JS IR] Export enum members like from usual classes
^KT-37916 fixed ^KT-44494 fixed
This commit is contained in:
+1
-1
@@ -100,7 +100,7 @@ class JsClassGenerator(private val irClass: IrClass, val context: JsGenerationCo
|
||||
|
||||
classBlock.statements += generateClassMetadata()
|
||||
|
||||
if (!irClass.isInterface && !irClass.isEnumClass && !irClass.isEnumEntry) {
|
||||
if (!irClass.isInterface && !irClass.isEnumEntry) {
|
||||
for (property in properties) {
|
||||
if (property.getter?.extensionReceiverParameter != null || property.setter?.extensionReceiverParameter != null)
|
||||
continue
|
||||
|
||||
+38
-3
@@ -12,13 +12,32 @@ enum class Foo {
|
||||
|
||||
val foo = ordinal
|
||||
|
||||
fun bar() = name
|
||||
fun bar(value: String) = value
|
||||
|
||||
fun bay() = name
|
||||
|
||||
companion object {
|
||||
val baz = "baz"
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
enum class Bar {
|
||||
A,
|
||||
B {
|
||||
var d = "d"
|
||||
init {
|
||||
d = "d2"
|
||||
}
|
||||
};
|
||||
|
||||
val foo = ordinal
|
||||
|
||||
fun bar(value: String) = value
|
||||
|
||||
fun bay() = name
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
function box() {
|
||||
if (this["export-enum-class"].Foo.A !== this["export-enum-class"].Foo.A) return "fail1"
|
||||
@@ -29,6 +48,22 @@ function box() {
|
||||
if (this["export-enum-class"].Foo.A.foo !== 0) return "fail4"
|
||||
if (this["export-enum-class"].Foo.B.foo !== 1) return "fail5"
|
||||
|
||||
if (this["export-enum-class"].Foo.A.bar() !== "A") return "fail6"
|
||||
if (this["export-enum-class"].Foo.B.bar() !== "B") return "fail7"
|
||||
if (this["export-enum-class"].Foo.A.bar("A") !== "A") return "fail6"
|
||||
if (this["export-enum-class"].Foo.B.bar("B") !== "B") return "fail7"
|
||||
|
||||
if (this["export-enum-class"].Foo.A.bay() !== "A") return "fail8"
|
||||
if (this["export-enum-class"].Foo.B.bay() !== "B") return "fail9"
|
||||
|
||||
if (this["export-enum-class"].Bar.A.foo !== 0) return "fail10"
|
||||
if (this["export-enum-class"].Bar.B.foo !== 1) return "fail11"
|
||||
|
||||
if (this["export-enum-class"].Bar.A.bar("A") !== "A") return "fail12"
|
||||
if (this["export-enum-class"].Bar.B.bar("B") !== "B") return "fail13"
|
||||
|
||||
if (this["export-enum-class"].Bar.A.bay() !== "A") return "fail14"
|
||||
if (this["export-enum-class"].Bar.B.bay() !== "B") return "fail15"
|
||||
|
||||
if (this["export-enum-class"].Bar.B.constructor.prototype.hasOwnProperty('baz')) return "fail16"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user