lazarus/components/codetools/tests/fdt_objccategory.pas
mattias 18825bf47b codetools: test for type helper
git-svn-id: trunk@49665 -
2015-08-14 08:11:08 +00:00

74 lines
1.1 KiB
ObjectPascal

unit fdt_objccategory;
{$mode objfpc}{$H+}
{$ModeSwitch objectivec1}
interface
uses
Classes, SysUtils;
type
{ TMyClass }
TMyClass = objcclass(NSObject)
end;
{ TCategoryA }
TCategoryA = objccategory(NSObject)
procedure categoryAmethod; message 'categoryAmethod';
end;
{ TCategoryB }
TCategoryB = objccategory(TMyClass)
procedure categoryBmethod; message 'categoryBmethod';
end;
{ TCategoryC }
TCategoryC = objccategory(TMyClass)
// contrary to helpers there can be multiple ObjCCategory active for a class
procedure categoryCmethod; message 'categoryCmethod';
end;
procedure DoIt;
implementation
{ TCategoryA }
procedure TCategoryA.categoryAmethod;
begin
end;
{ TCategoryB }
procedure TCategoryB.categoryBmethod;
begin
end;
{ TCategoryC }
procedure TCategoryC.categoryCmethod;
begin
end;
procedure DoIt;
var
a: TMyClass;
begin
a:=TMyClass(TMyClass.alloc).init;
a.categoryAmethod{declaration:fdt_objccategory.TCategoryA.categoryAmethod};
a.categoryBmethod{declaration:fdt_objccategory.TCategoryB.categoryBmethod};
a.categoryCmethod{declaration:fdt_objccategory.TCategoryC.categoryCmethod};
end;
end.