diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index 31e2171c8c..5ea45de3f0 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -912,11 +912,14 @@ implementation Delphi-compatible } hdef2:=tstoreddef(hdef).getcopy; tobjectdef(hdef2).childof:=tobjectdef(hdef); + tstoreddef(hdef2).orgdef:=tstoreddef(hdef); hdef:=hdef2; end else begin - hdef:=tstoreddef(hdef).getcopy; + hdef2:=tstoreddef(hdef).getcopy; + tstoreddef(hdef2).orgdef:=tstoreddef(hdef); + hdef:=hdef2; { check if it is an ansistirng(codepage) declaration } if is_ansistring(hdef) and try_to_consume(_LKLAMMER) then begin diff --git a/compiler/ppu.pas b/compiler/ppu.pas index eb5f8c8334..1775d8ed90 100644 --- a/compiler/ppu.pas +++ b/compiler/ppu.pas @@ -48,7 +48,7 @@ const CurrentPPUVersion = 208; { for any other changes to the ppu format, increase this version number (it's a cardinal) } - CurrentPPULongVersion = 18; + CurrentPPULongVersion = 19; { unit flags } uf_big_endian = $000004; diff --git a/compiler/symdef.pas b/compiler/symdef.pas index 651a015f43..64db7ebf80 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -138,6 +138,9 @@ interface genconstraintdata : tgenericconstraintdata; { this is Nil if the def has no RTTI attributes } rtti_attribute_list : trtti_attribute_list; + { original def for "type <name>" declarations } + orgdef : tstoreddef; + orgdefderef : tderef; constructor create(dt:tdeftyp;doregister:boolean); constructor ppuload(dt:tdeftyp;ppufile:tcompilerppufile); destructor destroy;override; @@ -2100,6 +2103,8 @@ implementation ppufile.getderef(typesymderef); ppufile.getset(tppuset2(defoptions)); ppufile.getset(tppuset1(defstates)); + if df_unique in defoptions then + ppufile.getderef(orgdefderef); if df_genconstraint in defoptions then begin genconstraintdata:=tgenericconstraintdata.create; @@ -2270,6 +2275,8 @@ implementation oldintfcrc:=ppufile.do_crc; ppufile.do_crc:=false; ppufile.putset(tppuset1(defstates)); + if df_unique in defoptions then + ppufile.putderef(orgdefderef); if df_genconstraint in defoptions then genconstraintdata.ppuwrite(ppufile); if [df_generic,df_specialization]*defoptions<>[] then @@ -2337,6 +2344,7 @@ implementation if not registered then register_def; typesymderef.build(typesym); + orgdefderef.build(orgdef); genericdefderef.build(genericdef); if assigned(rtti_attribute_list) then rtti_attribute_list.buildderef; @@ -2368,6 +2376,8 @@ implementation i : longint; begin typesym:=ttypesym(typesymderef.resolve); + if df_unique in defoptions then + orgdef:=tstoreddef(orgdefderef.resolve); if df_specialization in defoptions then genericdef:=tstoreddef(genericdefderef.resolve); if assigned(rtti_attribute_list) then diff --git a/compiler/utils/ppuutils/ppudump.pp b/compiler/utils/ppuutils/ppudump.pp index 4ffe02a23a..9ac093bc27 100644 --- a/compiler/utils/ppuutils/ppudump.pp +++ b/compiler/utils/ppuutils/ppudump.pp @@ -2872,6 +2872,12 @@ begin end; writeln; + if df_unique in defoptions then + begin + write ([space,' OriginalDef : ']); + readderef(space); + end; + if df_genconstraint in defoptions then begin ppufile.getset(tppuset1(genconstr));