فهرست منبع

compiler: clear vd_class option if it was added by _STATIC token (issue #0020119)

git-svn-id: trunk@19001 -
paul 14 سال پیش
والد
کامیت
7e88628b02
3فایلهای تغییر یافته به همراه24 افزوده شده و 3 حذف شده
  1. 1 0
      .gitattributes
  2. 11 3
      compiler/pdecvar.pas
  3. 12 0
      tests/webtbs/tw20119.pp

+ 1 - 0
.gitattributes

@@ -11767,6 +11767,7 @@ tests/webtbs/tw20035b.pp svneol=native#text/pascal
 tests/webtbs/tw2004.pp svneol=native#text/plain
 tests/webtbs/tw2004.pp svneol=native#text/plain
 tests/webtbs/tw20093.pp svneol=native#text/pascal
 tests/webtbs/tw20093.pp svneol=native#text/pascal
 tests/webtbs/tw20093a.pp svneol=native#text/pascal
 tests/webtbs/tw20093a.pp svneol=native#text/pascal
+tests/webtbs/tw20119.pp -text svneol=native#test/pascal
 tests/webtbs/tw2028.pp svneol=native#text/plain
 tests/webtbs/tw2028.pp svneol=native#text/plain
 tests/webtbs/tw2030.pp svneol=native#text/plain
 tests/webtbs/tw2030.pp svneol=native#text/plain
 tests/webtbs/tw2031.pp svneol=native#text/plain
 tests/webtbs/tw2031.pp svneol=native#text/plain

+ 11 - 3
compiler/pdecvar.pas

@@ -1500,7 +1500,8 @@ implementation
          uniondef : trecorddef;
          uniondef : trecorddef;
          hintsymoptions : tsymoptions;
          hintsymoptions : tsymoptions;
          deprecatedmsg : pshortstring;
          deprecatedmsg : pshortstring;
-         semicoloneaten: boolean;
+         semicoloneaten,
+         removeclassoption: boolean;
 {$if defined(powerpc) or defined(powerpc64)}
 {$if defined(powerpc) or defined(powerpc64)}
          tempdef: tdef;
          tempdef: tdef;
          is_first_type: boolean;
          is_first_type: boolean;
@@ -1519,7 +1520,8 @@ implementation
            consume(_ID);
            consume(_ID);
          { read vars }
          { read vars }
          sc:=TFPObjectList.create(false);
          sc:=TFPObjectList.create(false);
-         recstlist:=TFPObjectList.create(false);;
+         recstlist:=TFPObjectList.create(false);
+         removeclassoption:=false;
          while (token=_ID) and
          while (token=_ID) and
             not(((vd_object in options) or
             not(((vd_object in options) or
                  ((vd_record in options) and (m_advanced_records in current_settings.modeswitches))) and
                  ((vd_record in options) and (m_advanced_records in current_settings.modeswitches))) and
@@ -1654,7 +1656,8 @@ implementation
                  if not (vd_class in options) and try_to_consume(_STATIC) then
                  if not (vd_class in options) and try_to_consume(_STATIC) then
                    begin
                    begin
                      consume(_SEMICOLON);
                      consume(_SEMICOLON);
-                     include(options, vd_class);
+                     include(options,vd_class);
+                     removeclassoption:=true;
                    end;
                    end;
                end;
                end;
              if vd_class in options then
              if vd_class in options then
@@ -1675,6 +1678,11 @@ implementation
                      sl.addsym(sl_load,hstaticvs);
                      sl.addsym(sl_load,hstaticvs);
                      recst.insert(tabsolutevarsym.create_ref('$'+static_name,hdef,sl));
                      recst.insert(tabsolutevarsym.create_ref('$'+static_name,hdef,sl));
                    end;
                    end;
+                 if removeclassoption then
+                   begin
+                     exclude(options,vd_class);
+                     removeclassoption:=false;
+                   end;
                end;
                end;
              if (visibility=vis_published) and
              if (visibility=vis_published) and
                 not(is_class(hdef)) then
                 not(is_class(hdef)) then

+ 12 - 0
tests/webtbs/tw20119.pp

@@ -0,0 +1,12 @@
+{%norun}
+program tw20119;
+{$mode objfpc}
+type
+  T = class
+  private
+    F1: Integer; static;
+    F2: Integer; static;
+  end;
+begin
+end.
+