[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 throwIllegalStateException = internalFunction("ThrowIllegalStateException")
|
||||
val throwIllegalStateExceptionWithMessage = internalFunction("ThrowIllegalStateExceptionWithMessage")
|
||||
|
||||
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
|
||||
|| declaration.isExternal
|
||||
|| body == null
|
||||
|| declaration.isReifiedInline)
|
||||
|| body == null)
|
||||
return
|
||||
|
||||
generateFunction(codegen, declaration,
|
||||
@@ -687,6 +686,13 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
using(parameterScope) {
|
||||
using(VariableScope()) {
|
||||
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) {
|
||||
is IrBlockBody -> body.statements.forEach { generateStatement(it) }
|
||||
is IrExpressionBody -> generateStatement(body.expression)
|
||||
|
||||
@@ -66,6 +66,12 @@ internal fun ThrowIllegalStateException() : Nothing {
|
||||
throw IllegalStateException()
|
||||
}
|
||||
|
||||
@ExportForCppRuntime
|
||||
internal fun ThrowIllegalStateExceptionWithMessage(message:String) : Nothing {
|
||||
throw IllegalStateException(message)
|
||||
}
|
||||
|
||||
|
||||
@ExportForCppRuntime
|
||||
internal fun ThrowNotImplementedError(): Nothing {
|
||||
throw NotImplementedError("An operation is not implemented.")
|
||||
|
||||
Reference in New Issue
Block a user