IR: '!!' is generated as 'CHECK_NOT_NULL' intrinsic
``` fun <T : Any> CHECK_NOT_NULL(x: T?): x = if (x != null) x else throw NullPointerException(...) ``` This allows to compile both Kotlin/JVM and Kotlin/JS effectively.
This commit is contained in:
@@ -3,15 +3,6 @@ FILE fqName:<root> fileName:/dynamicExclExclOperator.kt
|
||||
VALUE_PARAMETER name:d index:0 type:dynamic
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test (d: dynamic): dynamic declared in <root>'
|
||||
BLOCK type=dynamic origin=EXCLEXCL
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp0_notnull type:dynamic [val]
|
||||
GET_VAR 'd: dynamic declared in <root>.test' type=dynamic origin=null
|
||||
WHEN type=dynamic origin=null
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp0_notnull: dynamic [val] declared in <root>.test' type=dynamic origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: CALL 'public final fun THROW_NPE (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=EXCLEXCL
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp0_notnull: dynamic [val] declared in <root>.test' type=dynamic origin=null
|
||||
CALL 'public final fun CHECK_NOT_NULL <T> (x: T of kotlin.internal.ir.CHECK_NOT_NULL?): T of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=dynamic origin=EXCLEXCL
|
||||
<T>: dynamic
|
||||
x: GET_VAR 'd: dynamic declared in <root>.test' type=dynamic origin=null
|
||||
|
||||
Reference in New Issue
Block a user