diff --git a/compiler/fppu.pas b/compiler/fppu.pas index 37d6c9bf23..a3f16570d1 100644 --- a/compiler/fppu.pas +++ b/compiler/fppu.pas @@ -194,14 +194,18 @@ var begin Message1(unit_u_reresolving_unit,modulename^); - tstoredsymtable(globalsymtable).deref(false); - tstoredsymtable(globalsymtable).derefimpl(false); + if tstoredsymtable(globalsymtable).is_deref_built then + tstoredsymtable(globalsymtable).deref(false); + if tstoredsymtable(globalsymtable).is_derefimpl_built then + tstoredsymtable(globalsymtable).derefimpl(false); if assigned(localsymtable) then begin { we have only builderef(impl)'d the registered symbols of the localsymtable -> also only deref those again } - tstoredsymtable(localsymtable).deref(true); - tstoredsymtable(localsymtable).derefimpl(true); + if tstoredsymtable(localsymtable).is_deref_built then + tstoredsymtable(localsymtable).deref(true); + if tstoredsymtable(localsymtable).is_derefimpl_built then + tstoredsymtable(localsymtable).derefimpl(true); end; if assigned(wpoinfo) then begin diff --git a/compiler/symtable.pas b/compiler/symtable.pas index eaa1169c6e..dd5ffe0118 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -36,9 +36,14 @@ interface ****************************************************************************} type + + { tstoredsymtable } + tstoredsymtable = class(TSymtable) private init_final_check_done : boolean; + deref_built : boolean; + derefimpl_built : boolean; procedure _needs_init_final(sym:TObject;arg:pointer); procedure do_init_final_check; procedure check_forward(sym:TObject;arg:pointer); @@ -73,6 +78,8 @@ interface procedure checklabels; function needs_init_final : boolean; virtual; function has_non_trivial_init:boolean;virtual; + function is_derefimpl_built: Boolean; + function is_deref_built: Boolean; procedure testfordefaultproperty(sym:TObject;arg:pointer); procedure register_children; end; @@ -697,6 +704,15 @@ implementation ppufile.writeentry(ibendsyms); end; + function tstoredsymtable.is_deref_built: Boolean; + begin + Result:=deref_built; + end; + + function tstoredsymtable.is_derefimpl_built: Boolean; + begin + Result:=derefimpl_built; + end; procedure tstoredsymtable.buildderef; var @@ -716,6 +732,7 @@ implementation sym:=tstoredsym(SymList[i]); sym.buildderef; end; + deref_built:=True; end; @@ -730,6 +747,7 @@ implementation def:=tstoreddef(DefList[i]); def.buildderefimpl; end; + derefimpl_built:=True; end;