* ngenutil.pas, tnodeutils.sym_maybe_initialize: Ensure that management operator (Initialize) is used also for local variables.

git-svn-id: trunk@35443 -
This commit is contained in:
maciej-izak 2017-02-18 19:19:46 +00:00
parent 520bb31fa6
commit 9441fb3968

View File

@ -308,7 +308,19 @@ implementation
class procedure tnodeutils.sym_maybe_initialize(p: TObject; arg: pointer);
begin
if (tsym(p).typ = localvarsym) and
if ((tsym(p).typ = localvarsym) or
{ check staticvarsym for record management opeators and for objects
which might contain record with management operators }
((tsym(p).typ = staticvarsym) and
(
(tabstractvarsym(p).vardef is trecorddef) or
(
(tabstractvarsym(p).vardef is tobjectdef) and
(tobjectdef(tabstractvarsym(p).vardef).objecttype = odt_object)
)
)
)
) and
{ local (procedure or unit) variables only need initialization if
they are used }
((tabstractvarsym(p).refs>0) or