mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2025-02-17 10:08:46 +00:00
fix class_addProtocol for first protocol
This commit is contained in:
parent
7709c897d6
commit
e03b72cacf
@ -669,12 +669,18 @@ BOOL class_addProtocol(Class cls,Protocol *protocol) {
|
||||
protocolList->next = 0;
|
||||
protocolList->list[0] = protocol;
|
||||
protocolList->count = 1;
|
||||
struct objc_protocol_list *protoList = cls->protocols;
|
||||
struct objc_protocol_list *lastList = protoList;
|
||||
while((protoList=protoList->next) != NULL) {
|
||||
lastList = protoList;
|
||||
}
|
||||
lastList->next = protocolList;
|
||||
if (cls->protocols != NULL) {
|
||||
struct objc_protocol_list *protoList = cls->protocols;
|
||||
struct objc_protocol_list *lastList = protoList;
|
||||
while((protoList=protoList->next) != NULL) {
|
||||
lastList = protoList;
|
||||
}
|
||||
lastList->next = protocolList;
|
||||
}
|
||||
else {
|
||||
cls->protocols = protocolList;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user