Browse Source

* fixed -CTauto(g|s)etterprefix automatically generated helpers in case they
have to wrap an existing (g|s)etter that was marked as "abstract" (don't
mark the helper also as abstract, sicnce it contains code)

git-svn-id: trunk@23545 -

Jonas Maebe 12 years ago
parent
commit
8f96ace589
5 changed files with 37 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 1 0
      compiler/jvm/pjvm.pas
  3. 4 0
      tests/test/jvm/testall.bat
  4. 2 0
      tests/test/jvm/testall.sh
  5. 29 0
      tests/test/jvm/tprop4.pp

+ 1 - 0
.gitattributes

@@ -10409,6 +10409,7 @@ tests/test/jvm/topovl.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/tprop3.pp svneol=native#text/plain
+tests/test/jvm/tprop4.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/tpvarglobal.pp svneol=native#text/plain

+ 1 - 0
compiler/jvm/pjvm.pas

@@ -993,6 +993,7 @@ implementation
               { getter/setter could have parameters in case of indexed access
                 -> copy original procdef }
               pd:=tprocdef(orgaccesspd.getcopy);
+              exclude(pd.procoptions,po_abstractmethod);
               { can only construct the artificial name now, because it requires
                 pd.defid }
               if not explicitwrapper then

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

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

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

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

+ 29 - 0
tests/test/jvm/tprop4.pp

@@ -0,0 +1,29 @@
+program tprop4;
+
+{$mode delphi}
+
+type
+  tprop4c = class
+   protected
+    function Gettest2: longint; virtual; abstract;
+   public
+    property test: longint read Gettest2;
+  end;
+
+  tprop4c2 = class(tprop4c)
+    protected
+     function Gettest2: longint; override;
+  end;
+
+  function tprop4c2.Gettest2: longint;
+    begin
+      result:=1;
+    end;
+
+var
+  c: tprop4c;
+begin
+  c:=tprop4c2.create;
+  if c.test<>1 then
+    halt(1);
+end.