mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 16:08:09 +02:00
41 lines
566 B
ObjectPascal
41 lines
566 B
ObjectPascal
program tcustomattr19;
|
|
|
|
{$mode objfpc}
|
|
{$modeswitch prefixedattributes}
|
|
|
|
uses
|
|
TypInfo;
|
|
|
|
type
|
|
TTestAttribute = class(TCustomAttribute)
|
|
constructor Create;
|
|
constructor Create(aArg: LongInt);
|
|
end;
|
|
|
|
[TTestAttribute(42), TTest]
|
|
TMyTest = class
|
|
|
|
end;
|
|
var
|
|
at: PAttributeTable;
|
|
|
|
constructor TTestAttribute.Create;
|
|
begin
|
|
|
|
end;
|
|
|
|
constructor TTestAttribute.Create(aArg: LongInt);
|
|
begin
|
|
|
|
end;
|
|
|
|
begin
|
|
at := GetAttributeTable(TMyTest.ClassInfo);
|
|
if not Assigned(at) then
|
|
Halt(1);
|
|
if at^.AttributeCount <> 2 then
|
|
Halt(2);
|
|
|
|
Writeln('ok');
|
|
end.
|