[KT-52681] Remove unnecessary semicolon after Objective-C @end

Objective-c `@end` doesn't need a semicolon, however KMM exported header
file, for instance:
```
__attribute__((swift_name("KotlinIterator")))
@protocol MyProjectKotlinIterator
@required
- (BOOL)hasNext __attribute__((swift_name("hasNext()")));
- (id _Nullable)next __attribute__((swift_name("next()")));
@end;
```
This creates problems with some code checkers that will not expect it
there, so it seems best to remove it.
This commit is contained in:
Diego Gomez Olvera
2022-06-08 14:13:52 +02:00
committed by SvyatoslavScherbina
parent 3840d09314
commit 9a430efbe7
59 changed files with 938 additions and 938 deletions
@@ -558,7 +558,7 @@ internal class ObjCCategoryStubBuilder(
val description = "${category.clazz.name} (${category.name})"
val meta = StubContainerMeta(
"// @interface $description",
"// @end; // $description"
"// @end // $description"
)
val container = SimpleStubContainer(
meta = meta,
@@ -50,7 +50,7 @@ object StubRenderer {
+renderProtocolHeader()
+"@required"
renderMembers(this, shouldExportKDoc)
+"@end;"
+"@end"
}
is ObjCInterface -> {
attributes.forEach {
@@ -58,7 +58,7 @@ object StubRenderer {
}
+renderInterfaceHeader()
renderMembers(this, shouldExportKDoc)
+"@end;"
+"@end"
}
is ObjCMethod -> {
+renderMethod(this)
@@ -3,7 +3,7 @@
#import <Foundation/NSUUID.h>
@interface MyClass1 : NSObject
@end;
@end
@interface MyClass2 : NSObject
@end;
@end
@@ -8,7 +8,7 @@
+ (double)doubleFn;
+ (simd_float4)simdFn;
@end;
@end
typedef struct {
float f;
@@ -65,4 +65,4 @@ typedef struct {
+ (GeterogeneousSmall)geterogeneousSmallFn;
@end;
@end
@@ -23,7 +23,7 @@
return v;
}
@end;
@end
@implementation AggregateTestSubject
@@ -78,4 +78,4 @@
return (simd_quatf){ {1, 4, 9, 25} };
}
@end;
@end
@@ -7,7 +7,7 @@
@protocol Printer;
@protocol Empty
@end;
@end
@protocol Forward;
@class Forward;
@@ -20,16 +20,16 @@ typedef NSString NSStringTypedef;
@interface Foo : NSObject <Empty>
@property NSStringTypedef* name;
-(void)helloWithPrinter:(id <Printer>)printer;
@end;
@end
@interface Foo (FooExtensions)
-(void)hello;
@end;
@end
@protocol Printer
@required
-(void)print:(const char*)string;
@end;
@end
@protocol MutablePair
@required
@@ -39,7 +39,7 @@ typedef NSString NSStringTypedef;
-(void)update:(int)index add:(int)delta;
-(void)update:(int)index sub:(int)delta;
@end;
@end
void replacePairElements(id <MutablePair> pair, int first, int second);
@@ -70,7 +70,7 @@ typedef NS_ENUM(int32_t, ForwardDeclaredEnum) {
@protocol ObjectFactory
@required
-(id)create;
@end;
@end
id createObjectWithFactory(id<ObjectFactory> factory) {
return [factory create];
@@ -82,15 +82,15 @@ id createObjectWithFactory(id<ObjectFactory> factory) {
-(void)consume:(id) __attribute__((ns_consumed)) obj;
-(void)consumeSelf __attribute__((ns_consumes_self));
-(void (^)(void))returnRetainedBlock:(void (^)(void))block __attribute__((ns_returns_retained));
@end;
@end
extern BOOL unexpectedDeallocation;
@interface MustNotBeDeallocated : NSObject
@end;
@end
@interface CustomRetainMethodsImpl : MustNotBeDeallocated <CustomRetainMethods>
@end;
@end
static MustNotBeDeallocated* retainedObj;
static void (^retainedBlock)(void);
@@ -4,14 +4,14 @@
@interface CPrinter : NSObject <Printer>
-(void)print:(const char*)string;
@end;
@end
@implementation CPrinter
-(void)print:(const char*)string {
printf("%s\n", string);
fflush(stdout);
}
@end;
@end
@implementation Foo
@@ -33,7 +33,7 @@
printf("Deallocated\n");
}
@end;
@end
@implementation Foo (FooExtensions)
@@ -41,7 +41,7 @@
CPrinter* printer = [[CPrinter alloc] init];
[self helloWithPrinter:printer];
}
@end;
@end
void replacePairElements(id <MutablePair> pair, int first, int second) {
[pair update:0 add:(first - pair.first)];
@@ -75,7 +75,7 @@ BOOL unexpectedDeallocation = NO;
-(void)dealloc {
unexpectedDeallocation = YES;
}
@end;
@end
static CustomRetainMethodsImpl* retainedCustomRetainMethodsImpl;
@@ -94,4 +94,4 @@ static CustomRetainMethodsImpl* retainedCustomRetainMethodsImpl;
-(void (^)(void))returnRetainedBlock:(void (^)(void))block __attribute__((ns_returns_retained)) {
return block;
}
@end;
@end
@@ -8,5 +8,5 @@
@property (nonatomic, readonly) NSObject *copyValue;
@property (nonatomic, readonly) NSObject *mutableCopyValue;
@end;
@end
@@ -17,4 +17,4 @@
return nil;
}
@end;
@end
@@ -2,8 +2,8 @@
@protocol KT38234_P1
-(int)foo;
@end;
@end
@interface KT38234_Base : NSObject <KT38234_P1>
-(int)callFoo;
@end;
@end
@@ -7,4 +7,4 @@
-(int)callFoo {
return [self foo];
}
@end;
@end
@@ -2,4 +2,4 @@
@interface TestAllocNoRetain : NSObject
@property BOOL ok;
@end;
@end
@@ -11,4 +11,4 @@
}
return self;
}
@end;
@end
@@ -3,7 +3,7 @@
@protocol BlockProvider
@required
-(int (^)(int)) block;
@end;
@end
int callProvidedBlock(id<BlockProvider> blockProvider, int argument) {
return [blockProvider block](argument);
@@ -12,7 +12,7 @@ int callProvidedBlock(id<BlockProvider> blockProvider, int argument) {
@protocol BlockConsumer
@required
-(int)callBlock:(int (^)(int))block argument:(int)argument;
@end;
@end
int callPlusOneBlock(id<BlockConsumer> blockConsumer, int argument) {
return [blockConsumer callBlock:^int(int p) { return p + 1; } argument:argument];
@@ -24,4 +24,4 @@ int callPlusOneBlock(id<BlockConsumer> blockConsumer, int argument) {
@property (class) void (^nullBlock)(void);
@property (class) void (^notNullBlock)(void);
@end;
@end
@@ -17,4 +17,4 @@
return ^{};
}
@end;
@end
@@ -4,4 +4,4 @@
@property int value;
- (int)instanceMethod;
+ (int)classMethod:(int)first :(int)second;
@end;
@end
@@ -8,4 +8,4 @@
+ (int)classMethod:(int)first :(int)second {
return first + second;
}
@end;
@end
@@ -6,17 +6,17 @@
-(NSString*)toString_;
-(int)hashCode;
-(BOOL)equals:(id _Nullable)other;
@end;
@end
@interface TestClashingWithAny2 : NSObject
-(void)toString;
-(void)hashCode;
-(void)equals:(int)p; // May clash.
@end;
@end
@interface TestClashingWithAny3 : NSObject
// Not clashing actually.
-(NSString*)toString:(int)p;
-(int)hashCode:(int)p;
-(BOOL)equals;
@end;
@end
@@ -24,7 +24,7 @@
-(BOOL)equals:(id _Nullable)other {
return YES;
}
@end;
@end
@implementation TestClashingWithAny2
-(NSString*)description {
@@ -43,7 +43,7 @@
-(void)equals:(int)p {
}
@end;
@end
@implementation TestClashingWithAny3
-(NSString*)description {
@@ -65,4 +65,4 @@
-(BOOL)equals {
return YES;
}
@end;
@end
@@ -2,4 +2,4 @@
@interface TestConstructorReturnsNull : NSObject
- (instancetype)init;
@end;
@end
@@ -4,4 +4,4 @@
- (instancetype)init {
return nil;
}
@end;
@end
@@ -3,7 +3,7 @@
@interface CustomString : NSString
- (instancetype)initWithValue:(int)value;
@property int value;
@end;
@end
CustomString* _Nonnull createCustomString(int value) {
return [[CustomString alloc] initWithValue:value];
@@ -29,4 +29,4 @@ BOOL customStringDeallocated = NO;
- (void)dealloc {
customStringDeallocated = YES;
}
@end;
@end
@@ -2,8 +2,8 @@
@protocol ExceptionThrower
-(void)throwException;
@end;
@end
@interface ExceptionThrowerManager : NSObject
+(void)throwExceptionWith:(id<ExceptionThrower>)thrower;
@end;
@end
@@ -4,4 +4,4 @@
+(void)throwExceptionWith:(id<ExceptionThrower>)thrower {
[thrower throwException];
}
@end;
@end
@@ -5,4 +5,4 @@
@property BOOL custom;
+(instancetype _Nonnull)createCustom;
@end;
@end
@@ -20,4 +20,4 @@
return [[self alloc] initCustom];
}
@end;
@end
@@ -5,6 +5,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface KT38850Color : NSObject
+(instancetype)blackColor;
@property NSString* name;
@end;
@end
NS_ASSUME_NONNULL_END
@@ -6,4 +6,4 @@
result.name = @"black";
return result;
}
@end;
@end
@@ -3,22 +3,22 @@
extern BOOL deallocRetainReleaseDeallocated;
@interface DeallocRetainRelease : NSObject
@end;
@end
extern DeallocRetainRelease* globalDeallocRetainRelease;
@protocol WeakReference
@required
@property (weak) id referent;
@end;
@end
@interface ObjCWeakReference : NSObject <WeakReference>
@property (weak) id referent;
@end;
@end
extern id <WeakReference> weakDeallocLoadWeak;
extern BOOL deallocLoadWeakDeallocated;
@interface DeallocLoadWeak : NSObject
-(void)checkWeak;
@end;
@end
@@ -13,12 +13,12 @@ BOOL deallocRetainReleaseDeallocated = NO;
assert(!deallocRetainReleaseDeallocated);
deallocRetainReleaseDeallocated = YES;
}
@end;
@end
DeallocRetainRelease* globalDeallocRetainRelease = nil;
@implementation ObjCWeakReference
@end;
@end
id <WeakReference> weakDeallocLoadWeak = nil;
BOOL deallocLoadWeakDeallocated = NO;
@@ -36,4 +36,4 @@ BOOL deallocLoadWeakDeallocated = NO;
assert(!deallocLoadWeakDeallocated);
deallocLoadWeakDeallocated = YES;
}
@end;
@end
@@ -5,6 +5,6 @@ extern id kt42482Global;
@interface KT42482 : NSObject
-(int)fortyTwo;
@end;
@end
void kt42482Swizzle(id obj);
@@ -13,7 +13,7 @@ id kt42482Global = nil;
-(void)dealloc {
kt42482Deallocated = YES;
}
@end;
@end
int fortyTwoSwizzledImp(id self, SEL _cmd) {
return 43;
@@ -3,7 +3,7 @@
// https://youtrack.jetbrains.com/issue/KT-49455
@interface KT49455 : NSObject
@end;
@end
__attribute__((external_source_symbol(language="Swift", defined_in="sample",generated_declaration)))
@interface KT49455 (KT49455Ext)
@@ -1,7 +1,7 @@
#import "kt49455.h"
@implementation KT49455
@end;
@end
@implementation KT49455 (KT49455Ext)
- (int)extensionFunction {
@@ -18,8 +18,8 @@ struct MyStruct myStruct = {11, 12, 13, 14};
@protocol Proto
@property int Companion; // clash on implementing
@end;
@end
@interface FooMangled : NSObject<Proto>
//- (void) CompanionS; // mangleSimple does not support this: it may clash after mangling
@end;
@end
@@ -3,4 +3,4 @@
// [KT-36067] mangling
@implementation FooMangled : NSObject
@synthesize Companion;
@end;
@end
@@ -2,16 +2,16 @@
@interface MultipleInheritanceClashBase : NSObject
@property (nonnull) MultipleInheritanceClashBase* delegate;
@end;
@end
@protocol MultipleInheritanceClash
@optional
@property (nullable) id<MultipleInheritanceClash> delegate;
@end;
@end
@interface MultipleInheritanceClash1 : MultipleInheritanceClashBase <MultipleInheritanceClash>
@end;
@end
@interface MultipleInheritanceClash2 : MultipleInheritanceClashBase <MultipleInheritanceClash>
@property MultipleInheritanceClashBase* delegate;
@end;
@end
@@ -1,10 +1,10 @@
#import "multipleInheritanceClash.h"
@implementation MultipleInheritanceClashBase
@end;
@end
@implementation MultipleInheritanceClash1
@end;
@end
@implementation MultipleInheritanceClash2
@end;
@end
@@ -4,10 +4,10 @@
@interface DeallocExecutor : NSObject
@property DeallocListener* deallocListener;
@end;
@end
@interface DeallocListener : NSObject
@property (weak) DeallocExecutor* deallocExecutor;
@property BOOL deallocated;
-(BOOL)deallocExecutorIsNil;
@end;
@end
@@ -4,10 +4,10 @@
-(void)dealloc {
self.deallocListener.deallocated = YES;
}
@end;
@end
@implementation DeallocListener
-(BOOL)deallocExecutorIsNil {
return self.deallocExecutor == nil;
}
@end;
@end
@@ -3,4 +3,4 @@
@interface TestOverrideInit : NSObject
-(instancetype)initWithValue:(int)value NS_DESIGNATED_INITIALIZER;
+(instancetype)createWithValue:(int)value;
@end;
@end
@@ -8,4 +8,4 @@
+(instancetype)createWithValue:(int)value {
return [[self alloc] initWithValue:value];
}
@end;
@end
@@ -3,4 +3,4 @@
@interface WeakRefHolder : NSObject
@property (weak) id obj;
-(void)loadManyTimes;
@end;
@end
@@ -8,4 +8,4 @@
[array addObject:self.obj];
}
}
@end;
@end
@@ -7,14 +7,14 @@
+(NSString* _Nonnull)stringWithFormat:(NSString*)format, ...;
+(NSObject* _Nonnull)stringWithFormat:(NSString*)format args:(void*)args;
@end;
@end
@interface TestVarargs (TestVarargsExtension)
-(instancetype _Nonnull)initWithFormat:(NSString*)format, ...;
@end;
@end
@interface TestVarargsSubclass : TestVarargs
// Test clashes:
-(instancetype _Nonnull)initWithFormat:(NSString*)format args:(void*)args;
+(NSString* _Nonnull)stringWithFormat:(NSString*)format args:(void*)args;
@end;
@end
@@ -38,7 +38,7 @@
abort();
}
@end;
@end
@implementation TestVarargsSubclass
-(instancetype _Nonnull)initWithFormat:(NSString*)format args:(void*)args {
@@ -48,4 +48,4 @@
+(NSString* _Nonnull)stringWithFormat:(NSString*)format args:(void*)args {
abort();
}
@end;
@end
@@ -2,8 +2,8 @@
@interface CreateAutoreleaseDeallocated : NSObject
@property BOOL value;
@end;
@end
@interface CreateAutorelease : NSObject
+(void)createAutorelease:(CreateAutoreleaseDeallocated*)deallocated;
@end;
@end
@@ -1,7 +1,7 @@
#import "workerAutoreleasePool.h"
@implementation CreateAutoreleaseDeallocated
@end;
@end
@implementation CreateAutorelease {
CreateAutoreleaseDeallocated* deallocated;
@@ -17,4 +17,4 @@
-(void)dealloc {
deallocated.value = YES;
}
@end;
@end
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -139,13 +139,13 @@ extern "C" OBJ_GETTER(Kotlin_ObjCExport_NSErrorAsException, id error) {
}
@interface NSError (NSErrorKotlinException)
@end;
@end
@implementation NSError (NSErrorKotlinException)
-(id)kotlinException {
auto userInfo = self.userInfo;
return userInfo == nullptr ? nullptr : userInfo[@"KotlinException"];
}
@end;
@end
#endif
@@ -16,7 +16,7 @@
@interface KotlinBase : NSObject <NSCopying>
+(instancetype)createRetainedWrapper:(ObjHeader*)obj;
@end;
@end
enum class ReleaseMode {
kRelease,
@@ -61,7 +61,7 @@ struct KotlinObjCClassData {
@protocol HasKotlinObjCClassData
@required
-(void*)_kotlinObjCClassData;
@end;
@end
static inline struct KotlinObjCClassData* GetKotlinClassData(id objOrClass) {
void* ptr = [(id<HasKotlinObjCClassData>)objOrClass _kotlinObjCClassData];
@@ -28,7 +28,7 @@
@interface NSObject (NSObjectPrivateMethods)
// Implemented for NSObject in libobjc/NSObject.mm
-(BOOL)_tryRetain;
@end;
@end
static void injectToRuntime();
@@ -167,10 +167,10 @@ static void injectToRuntime();
return [self retain];
}
@end;
@end
@interface NSObject (NSObjectToKotlin)
@end;
@end
@implementation NSObject (NSObjectToKotlin)
-(ObjHeader*)toKotlin:(ObjHeader**)OBJ_RESULT {
@@ -182,16 +182,16 @@ static void injectToRuntime();
return;
objc_release(self);
}
@end;
@end
@interface NSString (NSStringToKotlin)
@end;
@end
@implementation NSString (NSStringToKotlin)
-(ObjHeader*)toKotlin:(ObjHeader**)OBJ_RESULT {
RETURN_RESULT_OF(Kotlin_Interop_CreateKStringFromNSString, self);
}
@end;
@end
extern "C" {
@@ -209,7 +209,7 @@ OBJ_GETTER(Kotlin_boxDouble, KDouble value);
}
@interface NSNumber (NSNumberToKotlin)
@end;
@end
@implementation NSNumber (NSNumberToKotlin)
-(ObjHeader*)toKotlin:(ObjHeader**)OBJ_RESULT {
@@ -232,17 +232,17 @@ OBJ_GETTER(Kotlin_boxDouble, KDouble value);
default: RETURN_RESULT_OF(Kotlin_ObjCExport_convertUnmappedObjCObject, self);
}
}
@end;
@end
@interface NSDecimalNumber (NSDecimalNumberToKotlin)
@end;
@end
@implementation NSDecimalNumber (NSDecimalNumberToKotlin)
// Overrides [NSNumber toKotlin:] implementation.
-(ObjHeader*)toKotlin:(ObjHeader**)OBJ_RESULT {
RETURN_RESULT_OF(Kotlin_ObjCExport_convertUnmappedObjCObject, self);
}
@end;
@end
static void injectToRuntimeImpl() {
// If the code below fails, then it is most likely caused by KT-42254.
@@ -86,7 +86,7 @@ static inline KInt objCIndexToKotlinOrThrow(NSUInteger index) {
// when they are either frozen or if they are called on the worker that created them.
@interface NSArray (NSArrayToKotlin)
@end;
@end
@implementation NSArray (NSArrayToKotlin)
-(KRef)toKotlin:(KRef*)OBJ_RESULT {
@@ -98,10 +98,10 @@ static inline KInt objCIndexToKotlinOrThrow(NSUInteger index) {
return;
objc_release(self);
}
@end;
@end
@interface NSMutableArray (NSMutableArrayToKotlin)
@end;
@end
@implementation NSMutableArray (NSArrayToKotlin)
-(KRef)toKotlin:(KRef*)OBJ_RESULT {
@@ -113,11 +113,11 @@ static inline KInt objCIndexToKotlinOrThrow(NSUInteger index) {
return;
objc_release(self);
}
@end;
@end
@interface NSSet (NSSetToKotlin)
@end;
@end
@implementation NSSet (NSSetToKotlin)
-(KRef)toKotlin:(KRef*)OBJ_RESULT {
@@ -130,10 +130,10 @@ static inline KInt objCIndexToKotlinOrThrow(NSUInteger index) {
objc_release(self);
}
@end;
@end
@interface NSDictionary (NSDictionaryToKotlin)
@end;
@end
@implementation NSDictionary (NSDictionaryToKotlin)
-(KRef)toKotlin:(KRef*)OBJ_RESULT {
@@ -146,10 +146,10 @@ static inline KInt objCIndexToKotlinOrThrow(NSUInteger index) {
objc_release(self);
}
@end;
@end
@interface KIteratorAsNSEnumerator : NSEnumerator
@end;
@end
@implementation KIteratorAsNSEnumerator {
KRefSharedHolder iteratorHolder;
@@ -176,10 +176,10 @@ static inline KInt objCIndexToKotlinOrThrow(NSUInteger index) {
return nullptr;
}
}
@end;
@end
@interface KListAsNSArray : NSArray
@end;
@end
@implementation KListAsNSArray {
KRefSharedHolder listHolder;
@@ -212,10 +212,10 @@ static inline KInt objCIndexToKotlinOrThrow(NSUInteger index) {
return Kotlin_Collection_getSize(listHolder.ref<ErrorPolicy::kTerminate>());
}
@end;
@end
@interface KMutableListAsNSMutableArray : NSMutableArray
@end;
@end
@implementation KMutableListAsNSMutableArray {
KRefSharedHolder listHolder;
@@ -278,10 +278,10 @@ static inline KInt objCIndexToKotlinOrThrow(NSUInteger index) {
Kotlin_MutableList_setObject(listHolder.ref<ErrorPolicy::kTerminate>(), objCIndexToKotlinOrThrow(index), kotlinObject);
}
@end;
@end
@interface KSetAsNSSet : NSSet
@end;
@end
static inline id KSet_getElement(KRef set, id object) {
if (object == NSNull.null) {
@@ -338,10 +338,10 @@ static inline id KSet_getElement(KRef set, id object) {
ObjHolder holder;
return [KIteratorAsNSEnumerator createWithKIterator:Kotlin_Set_iterator(setHolder.ref<ErrorPolicy::kTerminate>(), holder.slot())];
}
@end;
@end
@interface KotlinMutableSet : NSMutableSet
@end;
@end
@implementation KotlinMutableSet {
KRefSharedHolder setHolder;
@@ -440,10 +440,10 @@ static inline id KSet_getElement(KRef set, id object) {
ObjHolder holder;
Kotlin_MutableCollection_removeObject(setHolder.ref<ErrorPolicy::kTerminate>(), refFromObjCOrNSNull(object, holder.slot()));
}
@end;
@end
@interface KMapAsNSDictionary : NSDictionary
@end;
@end
static inline id KMap_get(KRef map, id aKey) {
ObjHolder keyHolder, valueHolder;
@@ -497,10 +497,10 @@ static inline id KMap_get(KRef map, id aKey) {
return [KIteratorAsNSEnumerator createWithKIterator:Kotlin_Map_keyIterator(mapHolder.ref<ErrorPolicy::kTerminate>(), holder.slot())];
}
@end;
@end
@interface KotlinMutableDictionary : NSMutableDictionary
@end;
@end
@implementation KotlinMutableDictionary {
KRefSharedHolder mapHolder;
@@ -593,10 +593,10 @@ static inline id KMap_get(KRef map, id aKey) {
Kotlin_MutableMap_remove(mapHolder.ref<ErrorPolicy::kTerminate>(), kotlinKey);
}
@end;
@end
@interface NSEnumerator (NSEnumeratorAsAssociatedObject)
@end;
@end
@implementation NSEnumerator (NSEnumeratorAsAssociatedObject)
-(void)releaseAsAssociatedObject:(ReleaseMode)mode {
@@ -604,7 +604,7 @@ static inline id KMap_get(KRef map, id aKey) {
return;
objc_release(self);
}
@end;
@end
// Referenced from the generated code:
@@ -44,7 +44,7 @@ OBJ_GETTER(Kotlin_boxDouble, KDouble value);
#pragma clang diagnostic ignored "-Wobjc-designated-initializers"
@interface KotlinNumber : NSNumber
@end;
@end
[[ noreturn ]] static void incorrectNumberInitialization(KotlinNumber* self, SEL _cmd) {
[NSException raise:NSGenericException format:@"%@ can't be initialized with %s, use properly typed initialized",
@@ -94,7 +94,7 @@ OBJ_GETTER(Kotlin_boxDouble, KDouble value);
+ (NSNumber *)numberWithFloat:(float)value { incorrectNumberFactory(self, _cmd); }
+ (NSNumber *)numberWithDouble:(double)value { incorrectNumberFactory(self, _cmd); }
@end;
@end
/*
The code below is generated by:
@@ -116,7 +116,7 @@ fun main(args: Array<String>) {
private fun genBoolean(): String = """
@interface KotlinBoolean : KotlinNumber
@end;
@end
@implementation KotlinBoolean {
BOOL value_;
@@ -154,7 +154,7 @@ private fun genBoolean(): String = """
RETURN_RESULT_OF(Kotlin_boxBoolean, value_);
}
@end;
@end
""".trimIndent()
@@ -165,7 +165,7 @@ private fun genInteger(
kind: String = getNSNumberKind(cType)
) = """
@interface Kotlin$name : KotlinNumber
@end;
@end
@implementation Kotlin$name {
$cType value_;
@@ -206,7 +206,7 @@ private fun genInteger(
RETURN_RESULT_OF(Kotlin_box$name, value_);
}
@end;
@end
""".trimIndent()
@@ -220,7 +220,7 @@ private fun genFloating(
kind: String = getNSNumberKind(cType)
): String = """
@interface Kotlin$name : KotlinNumber
@end;
@end
@implementation Kotlin$name {
$cType value_;
@@ -268,7 +268,7 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_box$name, value_);
}
@end;
@end
""".trimIndent()
*/
@@ -276,7 +276,7 @@ ${if (cType != "double") """
// TODO: consider generating it by compiler.
@interface KotlinBoolean : KotlinNumber
@end;
@end
@implementation KotlinBoolean {
BOOL value_;
@@ -314,10 +314,10 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_boxBoolean, value_);
}
@end;
@end
@interface KotlinByte : KotlinNumber
@end;
@end
@implementation KotlinByte {
char value_;
@@ -358,10 +358,10 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_boxByte, value_);
}
@end;
@end
@interface KotlinShort : KotlinNumber
@end;
@end
@implementation KotlinShort {
short value_;
@@ -402,10 +402,10 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_boxShort, value_);
}
@end;
@end
@interface KotlinInt : KotlinNumber
@end;
@end
@implementation KotlinInt {
int value_;
@@ -446,10 +446,10 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_boxInt, value_);
}
@end;
@end
@interface KotlinLong : KotlinNumber
@end;
@end
@implementation KotlinLong {
long long value_;
@@ -490,10 +490,10 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_boxLong, value_);
}
@end;
@end
@interface KotlinUByte : KotlinNumber
@end;
@end
@implementation KotlinUByte {
unsigned char value_;
@@ -534,10 +534,10 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_boxUByte, value_);
}
@end;
@end
@interface KotlinUShort : KotlinNumber
@end;
@end
@implementation KotlinUShort {
unsigned short value_;
@@ -578,10 +578,10 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_boxUShort, value_);
}
@end;
@end
@interface KotlinUInt : KotlinNumber
@end;
@end
@implementation KotlinUInt {
unsigned int value_;
@@ -622,10 +622,10 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_boxUInt, value_);
}
@end;
@end
@interface KotlinULong : KotlinNumber
@end;
@end
@implementation KotlinULong {
unsigned long long value_;
@@ -666,10 +666,10 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_boxULong, value_);
}
@end;
@end
@interface KotlinFloat : KotlinNumber
@end;
@end
@implementation KotlinFloat {
float value_;
@@ -717,10 +717,10 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_boxFloat, value_);
}
@end;
@end
@interface KotlinDouble : KotlinNumber
@end;
@end
@implementation KotlinDouble {
double value_;
@@ -761,6 +761,6 @@ ${if (cType != "double") """
RETURN_RESULT_OF(Kotlin_boxDouble, value_);
}
@end;
@end
#endif // KONAN_OBJC_INTEROP
@@ -17,7 +17,7 @@
@interface KotlinObjectHolder : NSObject
-(id)initWithRef:(KRef)ref;
-(KRef)ref;
@end;
@end
@implementation KotlinObjectHolder {
KRefSharedHolder refHolder;
@@ -39,7 +39,7 @@
[super dealloc];
}
@end;
@end
static id Kotlin_Interop_createKotlinObjectHolder(KRef any) {
if (any == nullptr) {
@@ -59,7 +59,7 @@ static KRef Kotlin_Interop_unwrapKotlinObjectHolder(id holder) {
// Used as an associated object for ObjCWeakReferenceImpl.
@interface KotlinObjCWeakReference : NSObject
@end;
@end
// libobjc:
extern "C" {
@@ -81,7 +81,7 @@ void objc_release(id obj);
objc_release(self);
}
@end;
@end
extern "C" OBJ_GETTER(Kotlin_Interop_refFromObjC, id obj);