mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 12:19:30 +02:00
* call all operators with invokestatic, since they are always
class methods git-svn-id: branches/jvmbackend@19823 -
This commit is contained in:
parent
1950fb1fa8
commit
f4f70f99b2
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
|
||||
|
@ -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%
|
||||
|
||||
|
@ -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
29
tests/test/jvm/topovl.pp
Normal 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.
|
||||
|
Loading…
Reference in New Issue
Block a user