[IR] Adopted KotlinNothingValueExceptionLowering
This commit is contained in:
+6
@@ -171,6 +171,12 @@ internal val stringConcatenationPhase = makeKonanFileLoweringPhase(
|
||||
description = "String concatenation lowering"
|
||||
)
|
||||
|
||||
internal val kotlinNothingValueExceptionPhase = makeKonanFileLoweringPhase(
|
||||
::KotlinNothingValueExceptionLowering,
|
||||
name = "KotlinNothingValueException",
|
||||
description = "Throw proper exception for calls returning value of type 'kotlin.Nothing'"
|
||||
)
|
||||
|
||||
internal val enumConstructorsPhase = makeKonanFileLoweringPhase(
|
||||
::EnumConstructorsLowering,
|
||||
name = "EnumConstructors",
|
||||
|
||||
+1
@@ -355,6 +355,7 @@ internal val allLoweringsPhase = namedIrModulePhase(
|
||||
typeOperatorPhase then
|
||||
bridgesPhase then
|
||||
autoboxPhase then
|
||||
kotlinNothingValueExceptionPhase then
|
||||
returnsInsertionPhase
|
||||
),
|
||||
actions = setOf(defaultDumper, ::moduleValidationCallback)
|
||||
|
||||
+2
@@ -260,6 +260,8 @@ internal class KonanSymbols(
|
||||
|
||||
override val ThrowTypeCastException = internalFunction("ThrowTypeCastException")
|
||||
|
||||
override val ThrowKotlinNothingValueException = internalFunction("ThrowKotlinNothingValueException")
|
||||
|
||||
val throwClassCastException = internalFunction("ThrowClassCastException")
|
||||
|
||||
val throwInvalidReceiverTypeException = internalFunction("ThrowInvalidReceiverTypeException")
|
||||
|
||||
@@ -34,6 +34,11 @@ fun ThrowTypeCastException(): Nothing {
|
||||
throw TypeCastException()
|
||||
}
|
||||
|
||||
@ExportForCppRuntime
|
||||
fun ThrowKotlinNothingValueException(): Nothing {
|
||||
throw KotlinNothingValueException()
|
||||
}
|
||||
|
||||
@ExportForCppRuntime
|
||||
fun ThrowInvalidReceiverTypeException(klass: KClass<*>): Nothing {
|
||||
throw RuntimeException("Unexpected receiver type: " + (klass.qualifiedName ?: "noname"))
|
||||
|
||||
Reference in New Issue
Block a user