فهرست منبع

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

git-svn-id: trunk@35443 -
maciej-izak 8 سال پیش
والد
کامیت
9441fb3968
1فایلهای تغییر یافته به همراه13 افزوده شده و 1 حذف شده
  1. 13 1
      compiler/ngenutil.pas

+ 13 - 1
compiler/ngenutil.pas

@@ -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