[Wasm] Replace deprecated cast instructions
This commit is contained in:
committed by
Space Team
parent
45897cf045
commit
6437d0919c
@@ -159,7 +159,7 @@ internal fun isNullish(ref: ExternalInterfaceType?): Boolean =
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
internal fun returnArgumentIfItIsKotlinAny(ref: ExternalInterfaceType): Unit = implementedAsIntrinsic
|
||||
internal fun returnArgumentIfItIsKotlinAny(): Unit = implementedAsIntrinsic
|
||||
|
||||
internal fun externRefToAny(ref: ExternalInterfaceType): Any? {
|
||||
// TODO rewrite it so to get something like:
|
||||
@@ -169,7 +169,7 @@ internal fun externRefToAny(ref: ExternalInterfaceType): Any? {
|
||||
// return
|
||||
// }
|
||||
// If ref is an instance of kotlin class -- return it casted to Any
|
||||
returnArgumentIfItIsKotlinAny(ref)
|
||||
returnArgumentIfItIsKotlinAny()
|
||||
|
||||
// If we have Null in notNullRef -- return null
|
||||
// If we already have a box -- return it,
|
||||
|
||||
@@ -20,11 +20,16 @@ internal fun wasm_unreachable(): Nothing =
|
||||
implementedAsIntrinsic
|
||||
|
||||
@Suppress("REIFIED_TYPE_PARAMETER_NO_INLINE")
|
||||
internal fun <reified To> wasm_ref_cast_deprecated(a: Any?): To =
|
||||
internal fun <reified To> wasm_ref_cast_null(a: Any?): To =
|
||||
implementedAsIntrinsic
|
||||
|
||||
@Suppress("REIFIED_TYPE_PARAMETER_NO_INLINE")
|
||||
internal fun <reified To> wasm_ref_test_deprecated(a: Any?): Boolean =
|
||||
internal fun <reified To> wasm_ref_test(a: Any?): Boolean =
|
||||
implementedAsIntrinsic
|
||||
|
||||
@Suppress("REIFIED_TYPE_PARAMETER_NO_INLINE")
|
||||
@WasmOp(WasmOp.REF_TEST_NULL)
|
||||
internal fun <reified To> wasm_ref_test_null(a: Any?): Boolean =
|
||||
implementedAsIntrinsic
|
||||
|
||||
internal fun <T> wasm_array_copy(destination: T, destinationIndex: Int, source: T, sourceIndex: Int, length: Int): Unit =
|
||||
|
||||
@@ -247,12 +247,14 @@ internal annotation class WasmOp(val name: String) {
|
||||
const val I31_GET_S = "I31_GET_S"
|
||||
const val I31_GET_U = "I31_GET_U"
|
||||
const val REF_EQ = "REF_EQ"
|
||||
const val REF_TEST = "REF_TEST"
|
||||
const val REF_TEST_NULL = "REF_TEST_NULL"
|
||||
const val REF_CAST = "REF_CAST"
|
||||
const val REF_CAST_NULL = "REF_CAST_NULL"
|
||||
const val BR_ON_CAST = "BR_ON_CAST"
|
||||
const val BR_ON_CAST_FAIL = "BR_ON_CAST_FAIL"
|
||||
const val EXTERN_INTERNALIZE = "EXTERN_INTERNALIZE"
|
||||
const val EXTERN_EXTERNALIZE = "EXTERN_EXTERNALIZE"
|
||||
const val REF_TEST_DEPRECATED = "REF_TEST_DEPRECATED"
|
||||
const val REF_CAST_DEPRECATED = "REF_CAST_DEPRECATED"
|
||||
const val BR_ON_CAST_FAIL_DEPRECATED = "BR_ON_CAST_FAIL_DEPRECATED"
|
||||
const val BR_ON_NON_DATA_DEPRECATED = "BR_ON_NON_DATA_DEPRECATED"
|
||||
const val GET_UNIT = "GET_UNIT"
|
||||
const val PSEUDO_COMMENT_PREVIOUS_INSTR = "PSEUDO_COMMENT_PREVIOUS_INSTR"
|
||||
const val PSEUDO_COMMENT_GROUP_START = "PSEUDO_COMMENT_GROUP_START"
|
||||
|
||||
@@ -24,6 +24,6 @@ public fun <T : Any> T.toJsReference(): JsReference<T> =
|
||||
|
||||
/** Retrieve original Kotlin value from JsReference */
|
||||
public fun <T : Any> JsReference<T>.get(): T {
|
||||
returnArgumentIfItIsKotlinAny(this)
|
||||
returnArgumentIfItIsKotlinAny()
|
||||
throw ClassCastException("JsReference doesn't contain a Kotlin type")
|
||||
}
|
||||
Reference in New Issue
Block a user