Add stdlib API test + remove some extra IR stdlib API's

This commit is contained in:
Anton Bannykh
2020-05-11 20:46:52 +03:00
parent 1ed4324613
commit a18bfad53a
100 changed files with 34345 additions and 28 deletions
@@ -8,6 +8,6 @@ package kotlin.js
/**
* @param CT is return type of calling constructor (uses in DCE)
*/
fun <CT> construct(constructorType: dynamic, resultType: dynamic, vararg args: Any?): Any {
internal fun <CT> construct(constructorType: dynamic, resultType: dynamic, vararg args: Any?): Any {
return js("Reflect").construct(constructorType, args, resultType)
}
@@ -6,11 +6,11 @@
package kotlin.js
import kotlin.js.coroutineAliases.*
import kotlin.coroutines.*
@PublishedApi
internal fun <T> getContinuation(): ContinuationAlias<T> { throw Exception("Implemented as intrinsic") }
internal fun <T> getContinuation(): Continuation<T> { throw Exception("Implemented as intrinsic") }
// Do we really need this intrinsic in JS?
@PublishedApi
@@ -20,18 +20,18 @@ internal suspend fun <T> returnIfSuspended(@Suppress("UNUSED_PARAMETER") argumen
@PublishedApi
internal fun <T> interceptContinuationIfNeeded(
context: CoroutineContextAlias,
continuation: ContinuationAlias<T>
) = context[ContinuationInterceptorAlias]?.interceptContinuation(continuation) ?: continuation
context: CoroutineContext,
continuation: Continuation<T>
) = context[ContinuationInterceptor]?.interceptContinuation(continuation) ?: continuation
@SinceKotlin("1.2")
@PublishedApi
internal suspend fun getCoroutineContext(): CoroutineContextAlias = getContinuation<Any?>().context
internal suspend fun getCoroutineContext(): CoroutineContext = getContinuation<Any?>().context
// TODO: remove `JS` suffix oncec `NameGenerator` is implemented
@PublishedApi
internal suspend fun <T> suspendCoroutineUninterceptedOrReturnJS(block: (ContinuationAlias<T>) -> Any?): T =
internal suspend fun <T> suspendCoroutineUninterceptedOrReturnJS(block: (Continuation<T>) -> Any?): T =
returnIfSuspended<T>(block(getContinuation<T>()))