Native: add KotlinThrowable.asError() to the generated Obj-C framework

This method can be useful when overriding a throwing Kotlin method in
Swift or Obj-C. In this case, a user can call asError to wrap Kotlin exception
to (NS)Error and then throw it to Kotlin, which will unwrap it back.

^KT-45127 Fixed
This commit is contained in:
Svyatoslav Scherbina
2021-04-15 08:21:30 +00:00
committed by Space
parent c988ecf59b
commit d531df1643
12 changed files with 224 additions and 0 deletions
@@ -961,6 +961,10 @@ public abstract class KotlinBuiltIns {
return isConstructedFromGivenClass(type, FqNames.throwable);
}
public static boolean isThrowable(@NotNull ClassDescriptor descriptor) {
return classFqNameEquals(descriptor, FqNames.throwable.toUnsafe());
}
public static boolean isKClass(@NotNull ClassDescriptor descriptor) {
return classFqNameEquals(descriptor, FqNames.kClass);
}