[Wasm][Temporary] Stubs for typeOf and ::class constructs
This commit is contained in:
@@ -45,6 +45,11 @@ class WasmSymbols(
|
||||
private val kotlinTestPackage: PackageViewDescriptor =
|
||||
context.module.getPackage(FqName("kotlin.test"))
|
||||
|
||||
private val kotlinReflectPackage: PackageViewDescriptor =
|
||||
context.module.getPackage(FqName("kotlin.reflect"))
|
||||
|
||||
val typeOf = getFunction("typeOf", kotlinReflectPackage)
|
||||
|
||||
override val throwNullPointerException = getInternalFunction("THROW_NPE")
|
||||
override val throwISE = getInternalFunction("THROW_ISE")
|
||||
override val throwTypeCastException = getInternalFunction("THROW_CCE")
|
||||
|
||||
+16
@@ -64,6 +64,17 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV
|
||||
error("Unexpected element of type ${element::class}")
|
||||
}
|
||||
|
||||
override fun visitClassReference(expression: IrClassReference) {
|
||||
body.buildCall(context.referenceFunction(wasmSymbols.throwISE))
|
||||
body.buildUnreachable()
|
||||
}
|
||||
|
||||
override fun visitGetClass(expression: IrGetClass) {
|
||||
body.buildCall(context.referenceFunction(wasmSymbols.throwISE))
|
||||
body.buildUnreachable()
|
||||
}
|
||||
|
||||
|
||||
override fun visitThrow(expression: IrThrow) {
|
||||
generateExpression(expression.value)
|
||||
body.buildThrow(context.tagIdx)
|
||||
@@ -333,6 +344,11 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV
|
||||
}
|
||||
|
||||
when (function.symbol) {
|
||||
wasmSymbols.typeOf -> {
|
||||
body.buildCall(context.referenceFunction(wasmSymbols.throwISE))
|
||||
body.buildGetUnit()
|
||||
}
|
||||
|
||||
wasmSymbols.wasmClassId -> {
|
||||
val klass = call.getTypeArgument(0)!!.getClass()
|
||||
?: error("No class given for wasmClassId intrinsic")
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: CLASS_REFERENCES
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
import kotlin.coroutines.*
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun nonGenericId(x: Any?) = x
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: REFLECTION
|
||||
|
||||
fun box(): String {
|
||||
lateinit var str: String
|
||||
try {
|
||||
|
||||
Vendored
-3
@@ -1,8 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: REFLECTION
|
||||
|
||||
import kotlin.UninitializedPropertyAccessException
|
||||
|
||||
fun runNoInline(f: () -> Unit) = f()
|
||||
|
||||
-3
@@ -1,8 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: REFLECTION
|
||||
|
||||
import kotlin.UninitializedPropertyAccessException
|
||||
|
||||
fun runNoInline(f: () -> Unit) = f()
|
||||
|
||||
-3
@@ -1,8 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: REFLECTION
|
||||
|
||||
import kotlin.UninitializedPropertyAccessException
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: REFLECTION
|
||||
|
||||
import kotlin.UninitializedPropertyAccessException
|
||||
|
||||
fun box(): String {
|
||||
|
||||
-2
@@ -1,6 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: REFLECTION
|
||||
|
||||
// FILE: lateinit.kt
|
||||
|
||||
|
||||
-3
@@ -1,8 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: REFLECTION
|
||||
|
||||
import kotlin.UninitializedPropertyAccessException
|
||||
|
||||
lateinit var str: String
|
||||
|
||||
-3
@@ -1,8 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: REFLECTION
|
||||
|
||||
import kotlin.UninitializedPropertyAccessException
|
||||
|
||||
lateinit var str: String
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: IGNORED_IN_JS
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
|
||||
Reference in New Issue
Block a user