JS: adapt to 1.3 coroutines API

Also update a line number test
This commit is contained in:
Anton Bannykh
2018-08-28 17:56:34 +03:00
committed by Ilya Gorbunov
parent 2d04acba42
commit 8975a6e17e
5 changed files with 10 additions and 19 deletions
@@ -3,7 +3,7 @@
// DECLARES_VARIABLE: function=doResume name=k
// PROPERTY_READ_COUNT: name=local$o count=1
// PROPERTY_WRITE_COUNT: name=local$o count=2
import kotlin.coroutines.experimental.*
import kotlin.coroutines.*
var next: () -> Unit = {}
var complete = false
@@ -19,11 +19,7 @@ fun build(x: suspend () -> Unit) {
x.startCoroutine(object : Continuation<Unit> {
override val context = EmptyCoroutineContext
override fun resume(x: Unit) {
complete = true
}
override fun resumeWithException(x: Throwable) {
override fun resumeWith(x: SuccessOrFailure<Unit>) {
complete = true
}
})
@@ -1,7 +1,7 @@
// IGNORE_BACKEND: JS_IR
// EXPECTED_REACHABLE_NODES: 1250
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
private var next: () -> Unit = {}
private var stopped = false
@@ -12,11 +12,7 @@ suspend fun delay(): Unit = suspendCoroutine { c ->
fun build(c: suspend () -> Unit) {
c.startCoroutine(object : Continuation<Unit> {
override fun resume(x: Unit) {
stopped = true
}
override fun resumeWithException(x: Throwable) {
override fun resumeWith(x: SuccessOrFailure<Unit>) {
stopped = true
}
+3 -5
View File
@@ -2,8 +2,8 @@
// EXPECTED_REACHABLE_NODES: 1172
// FILE: a.kt
// WITH_RUNTIME
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
suspend fun suspendThere(v: String): String = suspendCoroutineOrReturn { x ->
x.resume(v)
@@ -21,9 +21,7 @@ fun builder(c: suspend () -> Unit) {
c.startCoroutine(object : Continuation<Unit> {
override val context = EmptyCoroutineContext
override fun resume(result: Unit) {}
override fun resumeWithException(exception: Throwable) {}
override fun resumeWith(result: SuccessOrFailure<Unit>) {}
})
}
@@ -1,3 +1,4 @@
// LANGUAGE_VERSION: 1.1
// EXPECTED_REACHABLE_NODES: 1112
package foo
+1 -1
View File
@@ -14,4 +14,4 @@ suspend fun bar(): Unit {
println(a + b)
}
// LINES: 4 4 4 5 5 5 5 6 4 4 4 15 9 9 9 9 15 9 9 9 * 15 10 10 11 11 11 11 11 * 11 12 12 13 13 13 13 13 13 13 14 14
// LINES: 36 36 4 45 45 15 9 9 9 9 15 9 9 9 * 15 10 10 11 11 11 11 11 * 11 12 12 13 13 13 13 13 13 13 14 14