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