* for unique type aliases keep track of the original def

* increase PPU version
This commit is contained in:
Sven/Sarah Barth 2023-06-23 15:52:30 +02:00
parent 74e24a3864
commit 62cc594ca4
4 changed files with 21 additions and 2 deletions

View File

@ -912,11 +912,14 @@ implementation
Delphi-compatible } Delphi-compatible }
hdef2:=tstoreddef(hdef).getcopy; hdef2:=tstoreddef(hdef).getcopy;
tobjectdef(hdef2).childof:=tobjectdef(hdef); tobjectdef(hdef2).childof:=tobjectdef(hdef);
tstoreddef(hdef2).orgdef:=tstoreddef(hdef);
hdef:=hdef2; hdef:=hdef2;
end end
else else
begin begin
hdef:=tstoreddef(hdef).getcopy; hdef2:=tstoreddef(hdef).getcopy;
tstoreddef(hdef2).orgdef:=tstoreddef(hdef);
hdef:=hdef2;
{ check if it is an ansistirng(codepage) declaration } { check if it is an ansistirng(codepage) declaration }
if is_ansistring(hdef) and try_to_consume(_LKLAMMER) then if is_ansistring(hdef) and try_to_consume(_LKLAMMER) then
begin begin

View File

@ -48,7 +48,7 @@ const
CurrentPPUVersion = 208; CurrentPPUVersion = 208;
{ for any other changes to the ppu format, increase this version number { for any other changes to the ppu format, increase this version number
(it's a cardinal) } (it's a cardinal) }
CurrentPPULongVersion = 18; CurrentPPULongVersion = 19;
{ unit flags } { unit flags }
uf_big_endian = $000004; uf_big_endian = $000004;

View File

@ -138,6 +138,9 @@ interface
genconstraintdata : tgenericconstraintdata; genconstraintdata : tgenericconstraintdata;
{ this is Nil if the def has no RTTI attributes } { this is Nil if the def has no RTTI attributes }
rtti_attribute_list : trtti_attribute_list; rtti_attribute_list : trtti_attribute_list;
{ original def for "type <name>" declarations }
orgdef : tstoreddef;
orgdefderef : tderef;
constructor create(dt:tdeftyp;doregister:boolean); constructor create(dt:tdeftyp;doregister:boolean);
constructor ppuload(dt:tdeftyp;ppufile:tcompilerppufile); constructor ppuload(dt:tdeftyp;ppufile:tcompilerppufile);
destructor destroy;override; destructor destroy;override;
@ -2100,6 +2103,8 @@ implementation
ppufile.getderef(typesymderef); ppufile.getderef(typesymderef);
ppufile.getset(tppuset2(defoptions)); ppufile.getset(tppuset2(defoptions));
ppufile.getset(tppuset1(defstates)); ppufile.getset(tppuset1(defstates));
if df_unique in defoptions then
ppufile.getderef(orgdefderef);
if df_genconstraint in defoptions then if df_genconstraint in defoptions then
begin begin
genconstraintdata:=tgenericconstraintdata.create; genconstraintdata:=tgenericconstraintdata.create;
@ -2270,6 +2275,8 @@ implementation
oldintfcrc:=ppufile.do_crc; oldintfcrc:=ppufile.do_crc;
ppufile.do_crc:=false; ppufile.do_crc:=false;
ppufile.putset(tppuset1(defstates)); ppufile.putset(tppuset1(defstates));
if df_unique in defoptions then
ppufile.putderef(orgdefderef);
if df_genconstraint in defoptions then if df_genconstraint in defoptions then
genconstraintdata.ppuwrite(ppufile); genconstraintdata.ppuwrite(ppufile);
if [df_generic,df_specialization]*defoptions<>[] then if [df_generic,df_specialization]*defoptions<>[] then
@ -2337,6 +2344,7 @@ implementation
if not registered then if not registered then
register_def; register_def;
typesymderef.build(typesym); typesymderef.build(typesym);
orgdefderef.build(orgdef);
genericdefderef.build(genericdef); genericdefderef.build(genericdef);
if assigned(rtti_attribute_list) then if assigned(rtti_attribute_list) then
rtti_attribute_list.buildderef; rtti_attribute_list.buildderef;
@ -2368,6 +2376,8 @@ implementation
i : longint; i : longint;
begin begin
typesym:=ttypesym(typesymderef.resolve); typesym:=ttypesym(typesymderef.resolve);
if df_unique in defoptions then
orgdef:=tstoreddef(orgdefderef.resolve);
if df_specialization in defoptions then if df_specialization in defoptions then
genericdef:=tstoreddef(genericdefderef.resolve); genericdef:=tstoreddef(genericdefderef.resolve);
if assigned(rtti_attribute_list) then if assigned(rtti_attribute_list) then

View File

@ -2872,6 +2872,12 @@ begin
end; end;
writeln; writeln;
if df_unique in defoptions then
begin
write ([space,' OriginalDef : ']);
readderef(space);
end;
if df_genconstraint in defoptions then if df_genconstraint in defoptions then
begin begin
ppufile.getset(tppuset1(genconstr)); ppufile.getset(tppuset1(genconstr));