Sfoglia il codice sorgente

* fixed web bug #6923 (old 5100): count references to private fields
from non-private properties

git-svn-id: trunk@4180 -

Jonas Maebe 19 anni fa
parent
commit
0d0766a595
4 ha cambiato i file con 68 aggiunte e 0 eliminazioni
  1. 2 0
      .gitattributes
  2. 4 0
      compiler/pdecvar.pas
  3. 37 0
      tests/webtbs/tw5100.pp
  4. 25 0
      tests/webtbs/tw5100a.pp

+ 2 - 0
.gitattributes

@@ -7208,6 +7208,8 @@ tests/webtbs/tw5036.pp svneol=native#text/plain
 tests/webtbs/tw5082.pp -text svneol=unset#text/plain
 tests/webtbs/tw5086.pp -text
 tests/webtbs/tw5094.pp -text
+tests/webtbs/tw5100.pp svneol=native#text/plain
+tests/webtbs/tw5100a.pp svneol=native#text/plain
 tests/webtbs/tw6203.pp svneol=native#text/plain
 tests/webtbs/tw6435.pp svneol=native#text/plain
 tests/webtbs/tw6491.pp svneol=native#text/plain

+ 4 - 0
compiler/pdecvar.pas

@@ -89,11 +89,15 @@ implementation
                   case sym.typ of
                     fieldvarsym :
                       begin
+                        if not(sp_private in current_object_option) then
+                          addsymref(sym);
                         pl.addsym(sl_load,sym);
                         def:=tfieldvarsym(sym).vartype.def;
                       end;
                     procsym :
                       begin
+                        if not(sp_private in current_object_option) then
+                          addsymref(sym);
                         pl.addsym(sl_call,sym);
                       end;
                     else

+ 37 - 0
tests/webtbs/tw5100.pp

@@ -0,0 +1,37 @@
+{ %norun }
+{ %OPT=-Sen }
+
+unit tw5100; 
+
+{$mode objfpc}{$H+}
+
+interface
+
+type
+
+  { TA }
+
+  TA = class
+  private
+    FT: string;
+  protected
+    property T: string read FT write FT;
+  end;
+
+  TB = class
+  private
+    FT: string;
+    property T: string read FT write FT;
+  protected
+    procedure test;
+  end;
+  
+implementation
+
+procedure tb.test;
+begin
+  writeln(t);
+end;
+
+end.
+      

+ 25 - 0
tests/webtbs/tw5100a.pp

@@ -0,0 +1,25 @@
+{ %norun }
+{ %OPT=-Sen }
+{ %fail }
+
+unit tw5100a; 
+
+{$mode objfpc}{$H+}
+
+interface
+
+type
+
+  { TB }
+
+  TB = class
+  private
+    FT: string;
+    property T: string read FT write FT;
+  end;
+  
+implementation
+
+
+end.
+