From b97ace9168f2599a205548163728221910a49c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Tue, 28 Jan 2025 14:33:16 +0100 Subject: [PATCH] * Patch from Simone Tacconi to fix alias type getdeclaration. Fixes issue #41109 --- packages/fcl-passrc/src/pastree.pp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/fcl-passrc/src/pastree.pp b/packages/fcl-passrc/src/pastree.pp index 7d5617bf89..efb0f9aff9 100644 --- a/packages/fcl-passrc/src/pastree.pp +++ b/packages/fcl-passrc/src/pastree.pp @@ -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));