* Patch from Simone Tacconi to fix alias type getdeclaration. Fixes issue #41109

This commit is contained in:
Michaël Van Canneyt 2025-01-28 14:33:16 +01:00
parent cbd9f716c2
commit b97ace9168

View File

@ -541,7 +541,7 @@ type
TPasType = class(TPasElement)
Protected
Function FixTypeDecl(aDecl: TPasTreeString) : TPasTreeString;
Function FixTypeDecl(aDecl: TPasTreeString) : TPasTreeString; virtual;
public
Function SafeName : TPasTreeString; override;
function ElementTypeName: TPasTreeString; override;
@ -551,6 +551,8 @@ type
{ TPasAliasType }
TPasAliasType = class(TPasType)
protected
Function FixTypeDecl(aDecl: TPasTreeString) : TPasTreeString; override;
public
procedure FreeChildren(Prepare: boolean); override;
function ElementTypeName: TPasTreeString; override;
@ -3372,6 +3374,19 @@ begin
inherited FreeChildren(Prepare);
end;
function TPasAliasType.FixTypeDecl(aDecl: TPasTreeString): TPasTreeString;
var
PasType : TPasType;
begin
Result:=aDecl;
PasType:=TPasTypeAliasType(Self).DestType;
Result:='type '+PasType.GetDeclaration(PasType is TPasUnresolvedTypeRef);
if (Name<>'') then
Result:=SafeName+' = '+Result;
ProcessHints(false,Result);
end;
procedure TPasAliasType.FreeChildren(Prepare: boolean);
begin
SubType:=TPasType(FreeChild(SubType,Prepare));