From 0d0766a595ffdb2ae1b5032f8de3f3d7ad95b48a Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Fri, 14 Jul 2006 15:34:02 +0000 Subject: [PATCH] * fixed web bug #6923 (old 5100): count references to private fields from non-private properties git-svn-id: trunk@4180 - --- .gitattributes | 2 ++ compiler/pdecvar.pas | 4 ++++ tests/webtbs/tw5100.pp | 37 +++++++++++++++++++++++++++++++++++++ tests/webtbs/tw5100a.pp | 25 +++++++++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 tests/webtbs/tw5100.pp create mode 100644 tests/webtbs/tw5100a.pp diff --git a/.gitattributes b/.gitattributes index 5dcf4ae706..016d8d2379 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas index 6810e0f087..ae05316935 100644 --- a/compiler/pdecvar.pas +++ b/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 diff --git a/tests/webtbs/tw5100.pp b/tests/webtbs/tw5100.pp new file mode 100644 index 0000000000..eb898fa7b9 --- /dev/null +++ b/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. + diff --git a/tests/webtbs/tw5100a.pp b/tests/webtbs/tw5100a.pp new file mode 100644 index 0000000000..95ca408a00 --- /dev/null +++ b/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. +