JS: add metadata for generated continuation classes to properly implement RTTI

This commit is contained in:
Alexey Andreev
2016-11-10 18:41:30 +03:00
parent 6860b2c057
commit d41d09ffc4
6 changed files with 74 additions and 7 deletions
@@ -0,0 +1,30 @@
// WITH_RUNTIME
// WITH_REFLECT
class Controller {
suspend fun runInstanceOf(x: Continuation<Boolean>) {
val y: Any = x
x.resume(x is Continuation<*>)
}
suspend fun runCast(x: Continuation<Boolean>) {
val y: Any = x
x.resume(Continuation::class.isInstance(y as Continuation<*>))
}
}
fun builder(coroutine c: Controller.() -> Continuation<Unit>) {
c(Controller()).resume(Unit)
}
fun box(): String {
var result = ""
builder {
result = runInstanceOf().toString() + "," + runCast().toString()
}
if (result != "true,true") return "fail: $result"
return "OK"
}