mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-06 15:50:37 +01:00
obcpas: fix categories implementing protocols
Allocate the ImplementedInterfaces array for them and save to/load from ppu Solves #39375
This commit is contained in:
parent
e924dd0d16
commit
fcb646bc3b
@ -48,7 +48,7 @@ const
|
||||
CurrentPPUVersion = 208;
|
||||
{ for any other changes to the ppu format, increase this version number
|
||||
(it's a cardinal) }
|
||||
CurrentPPULongVersion = 13;
|
||||
CurrentPPULongVersion = 14;
|
||||
|
||||
{ unit flags }
|
||||
uf_big_endian = $000004;
|
||||
|
||||
@ -7431,7 +7431,7 @@ implementation
|
||||
if objecttype in [odt_interfacecorba,odt_interfacecom,odt_dispinterface] then
|
||||
prepareguid;
|
||||
{ setup implemented interfaces }
|
||||
if objecttype in [odt_class,odt_objcclass,odt_objcprotocol,odt_javaclass,odt_interfacejava] then
|
||||
if objecttype in [odt_class,odt_objcclass,odt_objcprotocol,odt_objccategory,odt_javaclass,odt_interfacejava] then
|
||||
ImplementedInterfaces:=TFPObjectList.Create(true)
|
||||
else
|
||||
ImplementedInterfaces:=nil;
|
||||
@ -7489,7 +7489,7 @@ implementation
|
||||
end;
|
||||
|
||||
{ load implemented interfaces }
|
||||
if objecttype in [odt_class,odt_objcclass,odt_objcprotocol,odt_javaclass,odt_interfacejava] then
|
||||
if objecttype in [odt_class,odt_objcclass,odt_objcprotocol,odt_objccategory,odt_javaclass,odt_interfacejava] then
|
||||
begin
|
||||
ImplementedInterfaces:=TFPObjectList.Create(true);
|
||||
implintfcount:=ppufile.getlongint;
|
||||
|
||||
31
tests/webtbs/tw39375.pp
Normal file
31
tests/webtbs/tw39375.pp
Normal file
@ -0,0 +1,31 @@
|
||||
{ %target=darwin,ios,iphonesim }
|
||||
|
||||
program Project1;
|
||||
{$mode objfpc}{$H+}
|
||||
{$ModeSwitch objectivec1}
|
||||
type
|
||||
CBCentralManager = pointer;
|
||||
CBCentralManagerDelegateProtocol = objcprotocol external
|
||||
procedure centralManagerDidUpdateState (central: CBCentralManager); message 'centralManagerDidUpdateState:';
|
||||
end;
|
||||
|
||||
Test=objccategory(NSObject,CBCentralManagerDelegateProtocol)
|
||||
procedure centralManagerDidUpdateState (central: CBCentralManager);
|
||||
end;
|
||||
|
||||
var
|
||||
called: boolean = false;
|
||||
|
||||
procedure Test.centralManagerDidUpdateState (central: CBCentralManager);
|
||||
begin
|
||||
called:=true;
|
||||
end;
|
||||
|
||||
var
|
||||
o: NSObject;
|
||||
begin
|
||||
o := NSObject.alloc.init;
|
||||
o.centralManagerDidUpdateState(nil);
|
||||
if not called then
|
||||
halt(1);
|
||||
end.
|
||||
Loading…
Reference in New Issue
Block a user