[Wasm] Test infra: support _commonFiles and additional .mjs
Use custom `evalToBoolean` as `eval` and `unsafeCast` are not available in Wasm stdlib
This commit is contained in:
committed by
Space Team
parent
80e07d628b
commit
fd67464d14
+4
-1
@@ -1,6 +1,9 @@
|
||||
package testUtils
|
||||
|
||||
@JsName("eval")
|
||||
private external fun evalToBoolean(code: String): Boolean
|
||||
|
||||
fun isLegacyBackend(): Boolean =
|
||||
// Using eval to prevent DCE from thinking that following code depends on Kotlin module.
|
||||
eval("(typeof Kotlin != \"undefined\" && typeof Kotlin.kotlin != \"undefined\")").unsafeCast<Boolean>()
|
||||
evalToBoolean("(typeof Kotlin != \"undefined\" && typeof Kotlin.kotlin != \"undefined\")")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user