|
@@ -72,6 +72,7 @@ interface
|
|
|
procedure check_forwards;
|
|
|
procedure checklabels;
|
|
|
function needs_init_final : boolean; virtual;
|
|
|
+ function has_non_trivial_init:boolean;virtual;
|
|
|
procedure testfordefaultproperty(sym:TObject;arg:pointer);
|
|
|
procedure register_children;
|
|
|
end;
|
|
@@ -1070,7 +1071,7 @@ implementation
|
|
|
|
|
|
procedure TStoredSymtable._needs_init_final(sym:TObject;arg:pointer);
|
|
|
begin
|
|
|
- if sto_needs_init_final in tableoptions then
|
|
|
+ if [sto_needs_init_final,sto_has_non_trivial_init] <= tableoptions then
|
|
|
exit;
|
|
|
{ don't check static symbols - they can be present in structures only and
|
|
|
always have a reference to a symbol defined on unit level }
|
|
@@ -1085,6 +1086,9 @@ implementation
|
|
|
if assigned(tabstractvarsym(sym).vardef) and
|
|
|
is_managed_type(tabstractvarsym(sym).vardef) then
|
|
|
include(tableoptions,sto_needs_init_final);
|
|
|
+ if is_record((tabstractvarsym(sym).vardef)) and
|
|
|
+ (mop_initialize in trecordsymtable(trecorddef(tabstractvarsym(sym).vardef).symtable).managementoperators) then
|
|
|
+ include(tableoptions,sto_has_non_trivial_init);
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
@@ -1095,6 +1099,7 @@ implementation
|
|
|
if not init_final_check_done then
|
|
|
begin
|
|
|
exclude(tableoptions,sto_needs_init_final);
|
|
|
+ exclude(tableoptions,sto_has_non_trivial_init);
|
|
|
SymList.ForEachCall(@_needs_init_final,nil);
|
|
|
init_final_check_done:=true;
|
|
|
end;
|
|
@@ -1108,6 +1113,13 @@ implementation
|
|
|
end;
|
|
|
|
|
|
|
|
|
+ function tstoredsymtable.has_non_trivial_init:boolean;
|
|
|
+ begin
|
|
|
+ do_init_final_check;
|
|
|
+ result:=sto_has_non_trivial_init in tableoptions;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
{****************************************************************************
|
|
|
TAbstractRecordSymtable
|
|
|
****************************************************************************}
|