Browse Source

* Fixed DeclaredFields for record, should be the same as fields

Michaël Van Canneyt 1 year ago
parent
commit
fafb293426
1 changed files with 4 additions and 4 deletions
  1. 4 4
      packages/rtl-objpas/src/inc/rtti.pp

+ 4 - 4
packages/rtl-objpas/src/inc/rtti.pp

@@ -6122,13 +6122,12 @@ Var
 begin
 begin
   Tbl:=Nil;
   Tbl:=Nil;
   Len:=GetFieldList(FTypeInfo,Tbl);
   Len:=GetFieldList(FTypeInfo,Tbl);
-  SetLength(FFields,Len);
+  SetLength(FDeclaredFields,Len);
   FFieldsResolved:=True;
   FFieldsResolved:=True;
   if Len=0 then
   if Len=0 then
     exit;
     exit;
-  Ctx:=TRttiContext.Create;
+  Ctx:=TRttiContext.Create(Self.FUsePublishedOnly);
   try
   try
-    Ctx.UsePublishedOnly:=False;
     For I:=0 to Len-1 do
     For I:=0 to Len-1 do
       begin
       begin
       aData:=Tbl^[i];
       aData:=Tbl^[i];
@@ -6144,8 +6143,9 @@ begin
         Fld.FHandle:=aData;
         Fld.FHandle:=aData;
         Ctx.AddObject(Fld);
         Ctx.AddObject(Fld);
         end;
         end;
-      FFields[I]:=Fld;
+      FDeclaredFields[I]:=Fld;
       end;
       end;
+    FFields:=FDeclaredFields;
   finally
   finally
     if assigned(Tbl) then
     if assigned(Tbl) then
       FreeMem(Tbl);
       FreeMem(Tbl);