View Issue Details

IDProjectCategoryView StatusLast Update
0038945pas2jsrtlpublic2021-06-04 11:14
Reporterhenrique Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformPas2JsOSWindows 
Summary0038945: Ancestor implementation.
DescriptionDeclared the properties of the ancestors of the classes and interfaces in RTTI.
TagsNo tags attached.
Fixed in Revision
Attached Files

Activities

henrique

2021-05-28 14:48

reporter  

0001-Implementa-o-ancestor.patch (2,520 bytes)   
From 0c8feafede6ff80047255f4ce6d114a40d042258 Mon Sep 17 00:00:00 2001
From: Henrique Gottardi Werlang <henriquewerlang@hotmail.com>
Date: Fri, 28 May 2021 11:33:48 -0300
Subject: [PATCH] =?UTF-8?q?Implementa=C3=A7=C3=A3o=20ancestor.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 packages/rtl/rtti.pas | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/packages/rtl/rtti.pas b/packages/rtl/rtti.pas
index 7d549969..609f7f66 100644
--- a/packages/rtl/rtti.pas
+++ b/packages/rtl/rtti.pas
@@ -321,6 +321,7 @@ type
 
   TRttiInstanceType = class(TRttiStructuredType)
   private
+    function GetAncestorInstance: TRttiInstanceType;
     function GetClassTypeInfo: TTypeInfoClass;
     function GetMetaClassType: TClass;
   protected
@@ -328,6 +329,7 @@ type
   public
     constructor Create(ATypeInfo: PTypeInfo);
 
+    property Ancestor: TRttiInstanceType read GetAncestorInstance;
     property ClassTypeInfo: TTypeInfoClass read GetClassTypeInfo;
     property MetaClassType: TClass read GetMetaClassType;
   end;
@@ -336,6 +338,7 @@ type
 
   TRttiInterfaceType = class(TRttiStructuredType)
   private
+    function GetAncestorInterface: TRttiInterfaceType;
     function GetGUID: TGUID;
     function GetInterfaceTypeInfo: TTypeInfoInterface;
   protected
@@ -343,6 +346,7 @@ type
   public
     constructor Create(ATypeInfo: PTypeInfo);
 
+    property Ancestor: TRttiInterfaceType read GetAncestorInterface;
     property GUID: TGUID read GetGUID;
     property InterfaceTypeInfo: TTypeInfoInterface read GetInterfaceTypeInfo;
   end;
@@ -1186,7 +1190,12 @@ end;
 
 function TRttiInstanceType.GetAncestor: TRttiStructuredType;
 begin
-  Result := GRttiContext.GetType(ClassTypeInfo.Ancestor) as TRttiStructuredType;
+  Result := GetAncestorInstance;
+end;
+
+function TRttiInstanceType.GetAncestorInstance: TRttiInstanceType;
+begin
+  Result := GRttiContext.GetType(ClassTypeInfo.Ancestor) as TRttiInstanceType;
 end;
 
 constructor TRttiInstanceType.Create(ATypeInfo: PTypeInfo);
@@ -1222,7 +1231,12 @@ end;
 
 function TRttiInterfaceType.GetAncestor: TRttiStructuredType;
 begin
-  Result := GRttiContext.GetType(InterfaceTypeInfo.Ancestor) as TRttiStructuredType;
+  Result := GetAncestorInterface;
+end;
+
+function TRttiInterfaceType.GetAncestorInterface: TRttiInterfaceType;
+begin
+  Result := GRttiContext.GetType(InterfaceTypeInfo.Ancestor) as TRttiInterfaceType;
 end;
 
 { TRttiRecordType }
-- 
2.31.1.windows.1

henrique

2021-06-04 11:14

reporter   ~0131146

?

Issue History

Date Modified Username Field Change
2021-05-28 14:48 henrique New Issue
2021-05-28 14:48 henrique File Added: 0001-Implementa-o-ancestor.patch
2021-06-04 11:14 henrique Note Added: 0131146