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