[K/JS] Add serialization/deserialization for JsImport/JsExport nodes

This commit is contained in:
Artem Kobzar
2023-04-13 12:58:46 +00:00
committed by Space Team
parent 85644bbbf6
commit 5dc6da2b33
19 changed files with 196 additions and 22 deletions
@@ -0,0 +1,2 @@
data class Demo(val x: Int) {
}
@@ -0,0 +1,2 @@
class Demo(val x: Int) {
}
@@ -0,0 +1,2 @@
inline class Demo(val x: Int) {
}
@@ -0,0 +1,16 @@
STEP 0:
modifications:
U : l1.0_data_class.kt -> l1.kt
added file: l1.kt
STEP 1:
modifications:
U : l1.1_simple_class.kt -> l1.kt
modified ir: l1.kt
STEP 2:
modifications:
U : l1.2_inline_class.kt -> l1.kt
modified ir: l1.kt
STEP 3:
modifications:
U : l1.1_simple_class.kt -> l1.kt
modified ir: l1.kt
@@ -0,0 +1,18 @@
fun box(stepId: Int): String {
val d = Demo(15)
when (stepId) {
0, 2 -> {
if (!testEquals(d, Demo(15))) return "Fail equals"
if (testHashCode(d) != Demo(15).hashCode()) return "Fail hashCode"
if (testToString(d) != "Demo(x=15)") return "Fail toString"
}
1, 3-> {
if (testEquals(d, Demo(15))) return "Fail equals"
if (testHashCode(d) == Demo(15).hashCode()) return "Fail hashCode"
if (testToString(d) != "[object Object]") return "Fail toString"
}
else -> return "Unknown"
}
return "OK"
}
@@ -0,0 +1,6 @@
STEP 0:
dependencies: lib1
added file: m.kt, testEquals.kt, testHashCode.kt, testToString.kt
STEP 1..3:
dependencies: lib1
updated imports: m.kt, testEquals.kt, testHashCode.kt, testToString.kt
@@ -0,0 +1,3 @@
fun testEquals(lhs: Demo, rhs: Demo): Boolean {
return lhs == rhs
}
@@ -0,0 +1,3 @@
fun testHashCode(d: Demo): Int {
return d.hashCode()
}
@@ -0,0 +1,3 @@
fun testToString(d: Demo): String {
return d.toString()
}
@@ -0,0 +1,9 @@
MODULES: lib1, main
MODULE_KIND: es
STEP 0:
libs: lib1, main
dirty js: lib1, main
STEP 1..3:
libs: lib1, main
dirty js: lib1, main