View Issue Details

IDProjectCategoryView StatusLast Update
0038824pas2jsrtlpublic2021-04-30 11:22
Reporterhenrique Assigned ToMattias Gaertner  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformPas2JsOSWindows 
Summary0038824: Modifies the field load
DescriptionI modified the implementation to load the fields from the records.
TagsNo tags attached.
Fixed in Revision1176.
Attached Files

Activities

henrique

2021-04-29 16:34

reporter  

0001-Mudado-a-carga-de-field-para-carregar-os-fiels-do-re.patch (3,822 bytes)   
From c5cea3f0e6b8509fd81d96a224eb342b1a46cdf6 Mon Sep 17 00:00:00 2001
From: Henrique Gottardi Werlang <henriquewerlang@hotmail.com>
Date: Thu, 29 Apr 2021 10:32:18 -0300
Subject: [PATCH] Mudado a carga de field para carregar os fiels do record.

---
 packages/rtl/rtti.pas | 62 +++++++++++++++++++++----------------------
 1 file changed, 30 insertions(+), 32 deletions(-)

diff --git a/packages/rtl/rtti.pas b/packages/rtl/rtti.pas
index f993545e..18216ceb 100644
--- a/packages/rtl/rtti.pas
+++ b/packages/rtl/rtti.pas
@@ -281,6 +281,7 @@ type
 
   TRttiStructuredType = class abstract(TRttiType)
   private
+    FFields: TRttiFieldArray;
     FMethods: TRttiMethodArray;
     FProperties: TRttiPropertyArray;
   protected
@@ -291,8 +292,10 @@ type
 
     destructor Destroy; override;
 
+    function GetDeclaredFields: TRttiFieldArray; override;
     function GetDeclaredMethods: TRttiMethodArray; override;
     function GetDeclaredProperties: TRttiPropertyArray; override;
+    function GetFields: TRttiFieldArray; override;
     function GetMethod(const aName: String): TRttiMethod; override;
     function GetMethods: TRttiMethodArray; override;
     function GetMethods(const aName: String): TRttiMethodArray; override;
@@ -306,8 +309,6 @@ type
 
   TRttiInstanceType = class(TRttiStructuredType)
   private
-    FFields: TRttiFieldArray;
-
     function GetClassTypeInfo: TTypeInfoClass;
     function GetMetaClassType: TClass;
   protected
@@ -315,9 +316,6 @@ type
   public
     constructor Create(ATypeInfo: PTypeInfo);
 
-    function GetFields: TRttiFieldArray; override;
-    function GetDeclaredFields: TRttiFieldArray; override;
-
     property ClassTypeInfo: TTypeInfoClass read GetClassTypeInfo;
     property MetaClassType: TClass read GetMetaClassType;
   end;
@@ -992,31 +990,7 @@ begin
   Result := FMethods;
 end;
 
-{ TRttiInstanceType }
-
-function TRttiInstanceType.GetClassTypeInfo: TTypeInfoClass;
-begin
-  Result:=TTypeInfoClass(FTypeInfo);
-end;
-
-function TRttiInstanceType.GetMetaClassType: TClass;
-begin
-  Result:=ClassTypeInfo.ClassType;
-end;
-
-function TRttiInstanceType.GetAncestor: TRttiStructuredType;
-begin
-  Result := GRttiContext.GetType(ClassTypeInfo.Ancestor) as TRttiStructuredType;
-end;
-
-constructor TRttiInstanceType.Create(ATypeInfo: PTypeInfo);
-begin
-  if not (TTypeInfo(ATypeInfo) is TTypeInfoClass) then
-    raise EInvalidCast.Create('');
-  inherited Create(ATypeInfo);
-end;
-
-function TRttiInstanceType.GetDeclaredFields: TRttiFieldArray;
+function TRttiStructuredType.GetDeclaredFields: TRttiFieldArray;
 var
   A, FieldCount: Integer;
 
@@ -1034,7 +1008,7 @@ begin
   Result := FFields;
 end;
 
-function TRttiInstanceType.GetFields: TRttiFieldArray;
+function TRttiStructuredType.GetFields: TRttiFieldArray;
 var
   A, Start: Integer;
 
@@ -1060,6 +1034,30 @@ begin
   end;
 end;
 
+{ TRttiInstanceType }
+
+function TRttiInstanceType.GetClassTypeInfo: TTypeInfoClass;
+begin
+  Result:=TTypeInfoClass(FTypeInfo);
+end;
+
+function TRttiInstanceType.GetMetaClassType: TClass;
+begin
+  Result:=ClassTypeInfo.ClassType;
+end;
+
+function TRttiInstanceType.GetAncestor: TRttiStructuredType;
+begin
+  Result := GRttiContext.GetType(ClassTypeInfo.Ancestor) as TRttiStructuredType;
+end;
+
+constructor TRttiInstanceType.Create(ATypeInfo: PTypeInfo);
+begin
+  if not (TTypeInfo(ATypeInfo) is TTypeInfoClass) then
+    raise EInvalidCast.Create('');
+  inherited Create(ATypeInfo);
+end;
+
 { TRttiInterfaceType }
 
 constructor TRttiInterfaceType.Create(ATypeInfo: PTypeInfo);
@@ -1291,7 +1289,7 @@ end;
 
 function TRttiField.GetFieldType: TRttiType;
 begin
-  Result := GRttiContext.GetType(FTypeInfo);
+  Result := GRttiContext.GetType(FieldTypeInfo.TypeInfo);
 end;
 
 function TRttiField.GetFieldTypeInfo: TTypeMemberField;
-- 
2.31.1.windows.1

Mattias Gaertner

2021-04-30 11:22

manager   ~0130674

Thanks!

Issue History

Date Modified Username Field Change
2021-04-29 16:34 henrique New Issue
2021-04-29 16:34 henrique File Added: 0001-Mudado-a-carga-de-field-para-carregar-os-fiels-do-re.patch
2021-04-29 18:50 Mattias Gaertner Assigned To => Mattias Gaertner
2021-04-29 18:50 Mattias Gaertner Status new => assigned
2021-04-30 11:22 Mattias Gaertner Status assigned => resolved
2021-04-30 11:22 Mattias Gaertner Resolution open => fixed
2021-04-30 11:22 Mattias Gaertner Fixed in Revision => 1176.
2021-04-30 11:22 Mattias Gaertner Note Added: 0130674