[codegen] make generated reified inline function's bodies throwing k.IllegalStateException
This commit is contained in:
+1
@@ -229,6 +229,7 @@ internal class KonanSymbols(
|
|||||||
|
|
||||||
val throwInvalidReceiverTypeException = internalFunction("ThrowInvalidReceiverTypeException")
|
val throwInvalidReceiverTypeException = internalFunction("ThrowInvalidReceiverTypeException")
|
||||||
val throwIllegalStateException = internalFunction("ThrowIllegalStateException")
|
val throwIllegalStateException = internalFunction("ThrowIllegalStateException")
|
||||||
|
val throwIllegalStateExceptionWithMessage = internalFunction("ThrowIllegalStateExceptionWithMessage")
|
||||||
|
|
||||||
override val ThrowUninitializedPropertyAccessException = internalFunction("ThrowUninitializedPropertyAccessException")
|
override val ThrowUninitializedPropertyAccessException = internalFunction("ThrowUninitializedPropertyAccessException")
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -675,8 +675,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
|||||||
|
|
||||||
if ((declaration as? IrSimpleFunction)?.modality == Modality.ABSTRACT
|
if ((declaration as? IrSimpleFunction)?.modality == Modality.ABSTRACT
|
||||||
|| declaration.isExternal
|
|| declaration.isExternal
|
||||||
|| body == null
|
|| body == null)
|
||||||
|| declaration.isReifiedInline)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
generateFunction(codegen, declaration,
|
generateFunction(codegen, declaration,
|
||||||
@@ -687,6 +686,13 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
|||||||
using(parameterScope) {
|
using(parameterScope) {
|
||||||
using(VariableScope()) {
|
using(VariableScope()) {
|
||||||
recordCoverage(body)
|
recordCoverage(body)
|
||||||
|
if (declaration.isReifiedInline) {
|
||||||
|
callDirect(context.ir.symbols.throwIllegalStateExceptionWithMessage.owner,
|
||||||
|
listOf(context.llvm.staticData.kotlinStringLiteral(
|
||||||
|
"unsupported call of reified inlined function `${declaration.fqNameForIrSerialization}`").llvm),
|
||||||
|
Lifetime.IRRELEVANT)
|
||||||
|
return@using
|
||||||
|
}
|
||||||
when (body) {
|
when (body) {
|
||||||
is IrBlockBody -> body.statements.forEach { generateStatement(it) }
|
is IrBlockBody -> body.statements.forEach { generateStatement(it) }
|
||||||
is IrExpressionBody -> generateStatement(body.expression)
|
is IrExpressionBody -> generateStatement(body.expression)
|
||||||
|
|||||||
@@ -66,6 +66,12 @@ internal fun ThrowIllegalStateException() : Nothing {
|
|||||||
throw IllegalStateException()
|
throw IllegalStateException()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ExportForCppRuntime
|
||||||
|
internal fun ThrowIllegalStateExceptionWithMessage(message:String) : Nothing {
|
||||||
|
throw IllegalStateException(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ExportForCppRuntime
|
@ExportForCppRuntime
|
||||||
internal fun ThrowNotImplementedError(): Nothing {
|
internal fun ThrowNotImplementedError(): Nothing {
|
||||||
throw NotImplementedError("An operation is not implemented.")
|
throw NotImplementedError("An operation is not implemented.")
|
||||||
|
|||||||
Reference in New Issue
Block a user