* Fix parsing of type with attributes

This commit is contained in:
Michaël Van Canneyt 2024-04-05 18:51:41 +02:00
parent afa3cc5439
commit 760484c7a4

View File

@ -1466,10 +1466,12 @@ Var
isClamp, haveID,isNull,isUnsigned, isDoubleLong, ok: Boolean; isClamp, haveID,isNull,isUnsigned, isDoubleLong, ok: Boolean;
typeName: UTF8String; typeName: UTF8String;
Allowed : TIDLTokens; Allowed : TIDLTokens;
Attrs : TExtAttributeList;
tk : TIDLToken; tk : TIDLToken;
begin begin
Result:=Nil; Result:=Nil;
Attrs:=nil;
ok:=false; ok:=false;
try try
isNull:=False; isNull:=False;
@ -1481,8 +1483,8 @@ begin
isClamp:=False; isClamp:=False;
if tk=tkSquaredBraceOpen then if tk=tkSquaredBraceOpen then
begin begin
Result:=TIDLTypeDefDefinition(AddDefinition(aParent,TIDLTypeDefDefinition,'')); Attrs:=TExtAttributeList.Create;
ParseExtAttributes(Result.Attributes,tkSquaredBraceClose,False); ParseExtAttributes(Attrs,tkSquaredBraceClose,False);
tk:=GetToken; tk:=GetToken;
end; end;
if AllowExtraTypes then if AllowExtraTypes then
@ -1519,10 +1521,16 @@ begin
isNull:=True; isNull:=True;
end; end;
Result.AllowNull:=isNull; Result.AllowNull:=isNull;
if Assigned(Attrs) then
Result.Attributes:=Attrs;
Attrs:=nil;
ok:=true; ok:=true;
finally finally
if not ok then if not ok then
begin
MaybeFree(Result,aParent); MaybeFree(Result,aParent);
Attrs.Free;
end;
end; end;
end; end;