Browse Source

* not ignoring private/protected anymore, fixes bug #3969

git-svn-id: trunk@553 -
florian 20 years ago
parent
commit
bdc8b7d061
5 changed files with 65 additions and 3 deletions
  1. 2 0
      .gitattributes
  2. 4 2
      compiler/symtable.pas
  3. 1 1
      compiler/symtype.pas
  4. 17 0
      tests/webtbf/tw3969.pp
  5. 41 0
      tests/webtbf/tw3969u.pp

+ 2 - 0
.gitattributes

@@ -5474,6 +5474,8 @@ tests/webtbf/tw3738.pp svneol=native#text/plain
 tests/webtbf/tw3740.pp svneol=native#text/plain
 tests/webtbf/tw3790.pp svneol=native#text/plain
 tests/webtbf/tw3841.pp svneol=native#text/plain
+tests/webtbf/tw3969.pp svneol=native#text/plain
+tests/webtbf/tw3969u.pp svneol=native#text/plain
 tests/webtbf/tw4103.pp svneol=native#text/plain
 tests/webtbf/tw4111.pp svneol=native#text/plain
 tests/webtbf/tw4139.pp svneol=native#text/plain

+ 4 - 2
compiler/symtable.pas

@@ -1941,8 +1941,10 @@ implementation
           begin
             sym:=tsym(classh.symtable.speedsearch(s,speedvalue));
             if assigned(sym) and
-               Tsym(sym).is_visible_for_object(topclassh,current_procinfo.procdef._class) then
-              break;
+               tsym(sym).is_visible_for_object(topclassh,current_procinfo.procdef._class) then
+              break
+            else
+              sym:=nil;
             classh:=classh.childof;
           end;
          searchsym_in_class:=sym;

+ 1 - 1
compiler/symtype.pas

@@ -479,7 +479,7 @@ implementation
       end;
 
 
-    function Tsym.is_visible_for_object(currobjdef:Tdef;context : tdef):boolean;
+    function tsym.is_visible_for_object(currobjdef:Tdef;context : tdef):boolean;
       begin
         is_visible_for_object:=false;
 

+ 17 - 0
tests/webtbf/tw3969.pp

@@ -0,0 +1,17 @@
+{ %fail }
+{$Mode Delphi}
+{$R-,X+,V-}
+uses crt, tw3969u;
+
+var
+  myobj: testobj;
+
+begin
+  clrscr;
+  myobj.init;
+  writeln(myobj.getvar);
+  myobj.setvar('antonio');
+  myobj.myvar := 'pippo';
+  writeln(myobj.myvar);
+  myobj.done;
+end.

+ 41 - 0
tests/webtbf/tw3969u.pp

@@ -0,0 +1,41 @@
+{$Mode Delphi}
+{$R-,X+,V-}
+
+unit tw3969u;
+
+interface
+
+   type testobj = object
+      constructor init;
+      destructor done;
+      procedure setvar(value: string);
+      function getvar: string;
+
+      private
+
+      myvar: string;
+   end;
+
+implementation
+
+   constructor testobj.init;
+   begin
+      myvar := 'init';
+   end;
+
+   destructor testobj.done;
+   begin
+      myvar := 'done';
+   end;
+
+   procedure testobj.setvar;
+   begin
+      myvar := value;
+   end;
+
+   function testobj.getvar : string;
+   begin
+      result := myvar;
+   end;
+
+end.