Disable passing exceptions from Objective-C to Kotlin
since they can't be correctly handled yet.
This commit is contained in:
committed by
SvyatoslavScherbina
parent
12df524138
commit
6b042a5510
+9
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.native.interop.gen
|
||||
|
||||
import org.jetbrains.kotlin.native.interop.gen.jvm.KotlinPlatform
|
||||
import org.jetbrains.kotlin.native.interop.indexer.Language
|
||||
import org.jetbrains.kotlin.native.interop.indexer.NativeLibrary
|
||||
import org.jetbrains.kotlin.native.interop.indexer.mapFragmentIsCompilable
|
||||
|
||||
@@ -120,6 +121,14 @@ class SimpleBridgeGeneratorImpl(
|
||||
nativeLines.add(" $it")
|
||||
}
|
||||
|
||||
if (libraryForCStubs.language == Language.OBJECTIVE_C) {
|
||||
// Prevent Objective-C exceptions from passing to Kotlin:
|
||||
nativeLines.add(1, "@try {")
|
||||
nativeLines.add("} @catch (id e) { objc_terminate(); }")
|
||||
// 'objc_terminate' will report the exception.
|
||||
// TODO: consider implementing this in bitcode generator.
|
||||
}
|
||||
|
||||
nativeLines.add("}")
|
||||
kotlinLines.add("private external fun $kotlinFunctionName($kotlinParameters): ${returnType.kotlinType}")
|
||||
|
||||
|
||||
+7
-1
@@ -801,7 +801,13 @@ class StubGenerator(
|
||||
"-I$javaHome/../include/$it"
|
||||
}
|
||||
KotlinPlatform.NATIVE -> emptyList()
|
||||
}
|
||||
},
|
||||
|
||||
additionalPreambleLines = configuration.library.additionalPreambleLines +
|
||||
when (configuration.library.language) {
|
||||
Language.C -> emptyList()
|
||||
Language.OBJECTIVE_C -> listOf("void objc_terminate();")
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user