浏览代码

* inherit po_auto_raised_visibility flag when the visibility of a method is
raised because it was automatically raised in the parent class (can happen
for the JVM target when letting the compiler generate getters/setters for
properties)

git-svn-id: trunk@23522 -

Jonas Maebe 12 年之前
父节点
当前提交
e7315d035c
共有 5 个文件被更改,包括 46 次插入1 次删除
  1. 1 0
      .gitattributes
  2. 5 1
      compiler/nobj.pas
  3. 2 0
      tests/test/jvm/testall.bat
  4. 2 0
      tests/test/jvm/testall.sh
  5. 36 0
      tests/test/jvm/tprop3.pp

+ 1 - 0
.gitattributes

@@ -10408,6 +10408,7 @@ tests/test/jvm/tnestproc.pp svneol=native#text/plain
 tests/test/jvm/topovl.pp svneol=native#text/plain
 tests/test/jvm/topovl.pp svneol=native#text/plain
 tests/test/jvm/tprop.pp svneol=native#text/plain
 tests/test/jvm/tprop.pp svneol=native#text/plain
 tests/test/jvm/tprop2.pp svneol=native#text/plain
 tests/test/jvm/tprop2.pp svneol=native#text/plain
+tests/test/jvm/tprop3.pp svneol=native#text/plain
 tests/test/jvm/tpvar.pp svneol=native#text/plain
 tests/test/jvm/tpvar.pp svneol=native#text/plain
 tests/test/jvm/tpvardelphi.pp svneol=native#text/plain
 tests/test/jvm/tpvardelphi.pp svneol=native#text/plain
 tests/test/jvm/tpvarglobal.pp svneol=native#text/plain
 tests/test/jvm/tpvarglobal.pp svneol=native#text/plain

+ 5 - 1
compiler/nobj.pas

@@ -429,7 +429,11 @@ implementation
                       if po_auto_raised_visibility in vmtpd.procoptions then
                       if po_auto_raised_visibility in vmtpd.procoptions then
                         begin
                         begin
                           if updatevalues then
                           if updatevalues then
-                            pd.visibility:=vmtentryvis;
+                            begin
+                              pd.visibility:=vmtentryvis;
+                              { this one's visibility is now also auto-raised }
+                              include(pd.procoptions,po_auto_raised_visibility);
+                            end
                         end
                         end
                       else
                       else
 {$ifdef jvm}
 {$ifdef jvm}

+ 2 - 0
tests/test/jvm/testall.bat

@@ -252,3 +252,5 @@ ppcjvm -O2 -g -B ttincdec.pp
 if %errorlevel% neq 0 exit /b %errorlevel%
 if %errorlevel% neq 0 exit /b %errorlevel%
 java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. -Sa ttincdec
 java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. -Sa ttincdec
 if %errorlevel% neq 0 exit /b %errorlevel%
 if %errorlevel% neq 0 exit /b %errorlevel%
+ppcjvm -O2 -g -B -CTautogetterprefix=Get tprop3.pp
+if %errorlevel% neq 0 exit /b %errorlevel%

+ 2 - 0
tests/test/jvm/testall.sh

@@ -141,3 +141,5 @@ $PPC -O2 -g -B -Sa tw22807
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. tw22807
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. tw22807
 $PPC -O2 -g -B -Sa ttincdec.pp
 $PPC -O2 -g -B -Sa ttincdec.pp
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. ttincdec
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. ttincdec
+$PPC -O2 -g -B -CTautogetterprefix=Get tprop3
+

+ 36 - 0
tests/test/jvm/tprop3.pp

@@ -0,0 +1,36 @@
+program tprop3;
+
+{$mode delphi}
+
+type
+  tprop3c = class
+   protected
+    function Gettest: longint; virtual; abstract;
+   public
+    property test: longint read Gettest;
+  end;
+
+  tprop3c2 = class(tprop3c)
+   protected
+    function Gettest: longint; override;
+  end;
+
+  tprop3c3 = class(tprop3c2)
+   protected
+    function Gettest: longint; override;
+  end;
+
+
+function tprop3c2.Gettest: longint;
+begin
+  result:=1;
+end;
+
+
+function tprop3c3.Gettest: longint;
+begin
+  result:=2;
+end;
+
+begin
+end.