mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 15:49:22 +02:00
* allow use of multiple, comma separated attributes as Delphi allows that as well
+ added test git-svn-id: trunk@42409 -
This commit is contained in:
parent
6d0c470a40
commit
87458a065c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13215,6 +13215,7 @@ tests/test/tcustomattr15.pp svneol=native#text/pascal
|
||||
tests/test/tcustomattr16.pp svneol=native#text/pascal
|
||||
tests/test/tcustomattr17.pp svneol=native#text/pascal
|
||||
tests/test/tcustomattr18.pp svneol=native#text/pascal
|
||||
tests/test/tcustomattr19.pp svneol=native#text/pascal
|
||||
tests/test/tcustomattr2.pp svneol=native#text/pascal
|
||||
tests/test/tcustomattr3.pp svneol=native#text/pascal
|
||||
tests/test/tcustomattr4.pp svneol=native#text/pascal
|
||||
|
@ -436,6 +436,7 @@ implementation
|
||||
begin
|
||||
consume(_LECKKLAMMER);
|
||||
|
||||
repeat
|
||||
{ Parse attribute type }
|
||||
p:=factor(false,[ef_type_only,ef_check_attr_suffix]);
|
||||
if p.nodetype=typen then
|
||||
@ -515,6 +516,8 @@ implementation
|
||||
end;
|
||||
|
||||
p.free;
|
||||
until not try_to_consume(_COMMA);
|
||||
|
||||
consume(_RECKKLAMMER);
|
||||
end;
|
||||
|
||||
|
40
tests/test/tcustomattr19.pp
Normal file
40
tests/test/tcustomattr19.pp
Normal file
@ -0,0 +1,40 @@
|
||||
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.
|
Loading…
Reference in New Issue
Block a user