lazarus/components/codetools/tests/fdt_classhelper.pas
mattias 8f39050549 codetools: tests: class helpers Self.Method
git-svn-id: trunk@49979 -
2015-10-07 21:19:17 +00:00

74 lines
1021 B
ObjectPascal

{
Test with:
./finddeclarationtest --format=plain --suite=TestFindDeclaration_ClassHelper
}
unit fdt_classhelper;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
{ TStringsClassHelper }
TStringsClassHelper = class helper for TStrings
public
function MyVar: integer;
end;
{ TMyClass }
TMyClass = class(TObject)
public
procedure Hello;
end;
{ TMyClassHelper }
TMyClassHelper = class helper for TMyClass
public
procedure Hello2;
end;
procedure DoIt;
implementation
procedure DoIt;
var
sl: TStringList;
begin
sl:=TStringList{declaration:Classes.TStringList}.Create;
writeln('DoIt ',sl.MyVar{declaration:fdt_classhelper.TStringsClassHelper.MyVar});
sl.Free;
end;
{ TMyClassHelper }
procedure TMyClassHelper.Hello2;
begin
end;
{ TMyClass }
procedure TMyClass.Hello;
begin
Self.Hello2{declaration:fdt_classhelper.TMyClassHelper.Hello2};
end;
{ TStringsClassHelper }
function TStringsClassHelper.MyVar: integer;
begin
Result:=123;
end;
end.