* made rtti for dyn. arrays more delphi compatible, resolves #9464

git-svn-id: trunk@8853 -
This commit is contained in:
florian 2007-10-19 20:27:45 +00:00
parent bde44508b1
commit 4b172f5973
2 changed files with 36 additions and 3 deletions

View File

@ -538,12 +538,36 @@ implementation
current_asmdata.asmlists[al_rtti].concat(cai_align.Create(sizeof(TConstPtrUInt)));
{ size of elements }
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(def.elesize));
if not(ado_IsDynamicArray in def.arrayoptions) then
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(aint(def.elecount)));
{ element type }
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(def.elementdef,rt)));
begin
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(aint(def.elecount)));
{ element type }
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(def.elementdef,rt)));
end
else
{ write a delphi almost compatible dyn. array entry:
there are two types, eltype and eltype2, the latter is nil if the element type needs
no finalization, the former is always valid, delphi has this swapped, but for
compatibility with older fpc versions we do it different, to be delphi compatible,
the names are swapped in typinfo.pp
}
begin
{ element type }
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(def.elementdef,rt)));
end;
{ variant type }
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(tstoreddef(def.elementdef).getvardef));
if ado_IsDynamicArray in def.arrayoptions then
begin
{ element type }
if def.elementdef.needs_inittable then
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(def.elementdef,rt)))
else
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(0));
{ dummy DynUnitName }
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(0));
end;
end;
procedure recorddef_rtti(def:trecorddef);

View File

@ -63,6 +63,7 @@ unit typinfo;
type
TTypeKinds = set of TTypeKind;
ShortStringBase = string[255];
{$PACKRECORDS 1}
TTypeInfo = record
@ -141,6 +142,14 @@ unit typinfo;
RawIntfUnit: ShortString;
IIDStr: ShortString;
);
tkDynArray:
(
elSize : PtrUInt;
elType2 : PPTypeInfo;
varType : Longint;
elType : PPTypeInfo;
DynUnitName: ShortStringBase
);
end;
// unsed, just for completeness