* call all operators with invokestatic, since they are always

class methods

git-svn-id: branches/jvmbackend@19823 -
This commit is contained in:
Jonas Maebe 2011-12-11 17:25:42 +00:00
parent 1950fb1fa8
commit f4f70f99b2
5 changed files with 40 additions and 2 deletions

1
.gitattributes vendored
View File

@ -9797,6 +9797,7 @@ tests/test/jvm/tintstr.pp svneol=native#text/plain
tests/test/jvm/tnestdynarr.pp svneol=native#text/plain
tests/test/jvm/tnestedset.pp svneol=native#text/plain
tests/test/jvm/tnestproc.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/tprop2.pp svneol=native#text/plain
tests/test/jvm/tpvar.pp svneol=native#text/plain

View File

@ -2280,7 +2280,8 @@ implementation
case tobjectdef(pd.owner.defowner).objecttype of
odt_javaclass:
begin
if (po_classmethod in pd.procoptions) then
if (po_classmethod in pd.procoptions) or
(pd.proctypeoption=potype_operator) then
opc:=a_invokestatic
else if (pd.visibility=vis_strictprivate) or
(pd.proctypeoption=potype_constructor) or
@ -2298,7 +2299,8 @@ implementation
end;
recordsymtable:
begin
if (po_staticmethod in pd.procoptions) then
if (po_staticmethod in pd.procoptions) or
(pd.proctypeoption=potype_operator) then
opc:=a_invokestatic
else if (pd.visibility=vis_strictprivate) or
(pd.proctypeoption=potype_constructor) or

View File

@ -224,4 +224,8 @@ ppcjvm -O2 -g -B tnestdynarr
if %errorlevel% neq 0 exit /b %errorlevel%
java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. tnestdynarr
if %errorlevel% neq 0 exit /b %errorlevel%
ppcjvm -O2 -g -B topovl
if %errorlevel% neq 0 exit /b %errorlevel%
java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. topovl
if %errorlevel% neq 0 exit /b %errorlevel%

View File

@ -122,3 +122,5 @@ $PPC -O2 -g -B tdynarrnil
java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/jvm-java:. tdynarrnil
$PPC -O2 -g -B tnestdynarr
java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/jvm-java:. tnestdynarr
$PPC -O2 -g -B topovl
java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/jvm-java:. topovl

29
tests/test/jvm/topovl.pp Normal file
View File

@ -0,0 +1,29 @@
{$mode delphi}
program topovl;
type
complex = record
re,im: real;
class operator multiply(r : real; const z1 : complex): complex;
end;
class Operator complex.multiply (r : real; const z1 : complex): complex;
begin
result.re := z1.re * r;
result.im := z1.im * r;
end;
var
R : real;
C,Z : complex;
begin
r:=2.0;
c.re:=3.0;
c.im:=4.0;
C:=R*Z;
end.