mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 09:29:26 +02:00
* when automatically generating (s|g)etters, make sure that the visibility of
(g|s)etters whose naming convention is already correct is adjusted if necessary git-svn-id: trunk@23546 -
This commit is contained in:
parent
8f96ace589
commit
ddc03bdf03
@ -332,9 +332,6 @@ implementation
|
|||||||
hdef : tdef;
|
hdef : tdef;
|
||||||
arraytype : tdef;
|
arraytype : tdef;
|
||||||
def : tdef;
|
def : tdef;
|
||||||
{$ifdef jvm}
|
|
||||||
orgaccesspd : tprocdef;
|
|
||||||
{$endif}
|
|
||||||
pt : tnode;
|
pt : tnode;
|
||||||
sc : TFPObjectList;
|
sc : TFPObjectList;
|
||||||
paranr : word;
|
paranr : word;
|
||||||
@ -346,6 +343,10 @@ implementation
|
|||||||
storedprocdef: tprocvardef;
|
storedprocdef: tprocvardef;
|
||||||
readprocdef,
|
readprocdef,
|
||||||
writeprocdef : tprocdef;
|
writeprocdef : tprocdef;
|
||||||
|
{$ifdef jvm}
|
||||||
|
orgaccesspd : tprocdef;
|
||||||
|
wrongvisibility : boolean;
|
||||||
|
{$endif}
|
||||||
begin
|
begin
|
||||||
{ Generate temp procdefs to search for matching read/write
|
{ Generate temp procdefs to search for matching read/write
|
||||||
procedures. the readprocdef will store all definitions }
|
procedures. the readprocdef will store all definitions }
|
||||||
@ -534,18 +535,20 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{$ifdef jvm}
|
{$ifdef jvm}
|
||||||
orgaccesspd:=tprocdef(p.propaccesslist[palt_read].procdef);
|
orgaccesspd:=tprocdef(p.propaccesslist[palt_read].procdef);
|
||||||
|
wrongvisibility:=tprocdef(p.propaccesslist[palt_read].procdef).visibility<p.visibility;
|
||||||
|
if (prop_auto_getter_prefix<>'') and
|
||||||
|
(wrongvisibility or
|
||||||
|
(p.propaccesslist[palt_read].firstsym^.sym.RealName<>prop_auto_getter_prefix+p.RealName)) then
|
||||||
|
jvm_create_getter_for_property(p,orgaccesspd)
|
||||||
{ if the visibility of the getter is lower than
|
{ if the visibility of the getter is lower than
|
||||||
the visibility of the property, wrap it so that
|
the visibility of the property, wrap it so that
|
||||||
we can call it from all contexts in which the
|
we can call it from all contexts in which the
|
||||||
property is visible }
|
property is visible }
|
||||||
if (tprocdef(p.propaccesslist[palt_read].procdef).visibility<p.visibility) then
|
else if wrongvisibility then
|
||||||
begin
|
begin
|
||||||
p.propaccesslist[palt_read].procdef:=jvm_wrap_method_with_vis(tprocdef(p.propaccesslist[palt_read].procdef),p.visibility);
|
p.propaccesslist[palt_read].procdef:=jvm_wrap_method_with_vis(tprocdef(p.propaccesslist[palt_read].procdef),p.visibility);
|
||||||
p.propaccesslist[palt_read].firstsym^.sym:=tprocdef(p.propaccesslist[palt_read].procdef).procsym;
|
p.propaccesslist[palt_read].firstsym^.sym:=tprocdef(p.propaccesslist[palt_read].procdef).procsym;
|
||||||
end;
|
end;
|
||||||
if (prop_auto_getter_prefix<>'') and
|
|
||||||
(p.propaccesslist[palt_read].firstsym^.sym.RealName<>prop_auto_getter_prefix+p.RealName) then
|
|
||||||
jvm_create_getter_for_property(p,orgaccesspd);
|
|
||||||
{$endif jvm}
|
{$endif jvm}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -615,18 +618,20 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{$ifdef jvm}
|
{$ifdef jvm}
|
||||||
orgaccesspd:=tprocdef(p.propaccesslist[palt_write].procdef);
|
orgaccesspd:=tprocdef(p.propaccesslist[palt_write].procdef);
|
||||||
|
wrongvisibility:=tprocdef(p.propaccesslist[palt_write].procdef).visibility<p.visibility;
|
||||||
|
if (prop_auto_setter_prefix<>'') and
|
||||||
|
((sym.RealName<>prop_auto_setter_prefix+p.RealName) or
|
||||||
|
wrongvisibility) then
|
||||||
|
jvm_create_setter_for_property(p,orgaccesspd)
|
||||||
{ if the visibility of the setter is lower than
|
{ if the visibility of the setter is lower than
|
||||||
the visibility of the property, wrap it so that
|
the visibility of the property, wrap it so that
|
||||||
we can call it from all contexts in which the
|
we can call it from all contexts in which the
|
||||||
property is visible }
|
property is visible }
|
||||||
if (tprocdef(p.propaccesslist[palt_write].procdef).visibility<p.visibility) then
|
else if wrongvisibility then
|
||||||
begin
|
begin
|
||||||
p.propaccesslist[palt_write].procdef:=jvm_wrap_method_with_vis(tprocdef(p.propaccesslist[palt_write].procdef),p.visibility);
|
p.propaccesslist[palt_write].procdef:=jvm_wrap_method_with_vis(tprocdef(p.propaccesslist[palt_write].procdef),p.visibility);
|
||||||
p.propaccesslist[palt_write].firstsym^.sym:=tprocdef(p.propaccesslist[palt_write].procdef).procsym;
|
p.propaccesslist[palt_write].firstsym^.sym:=tprocdef(p.propaccesslist[palt_write].procdef).procsym;
|
||||||
end;
|
end;
|
||||||
if (prop_auto_setter_prefix<>'') and
|
|
||||||
(sym.RealName<>prop_auto_setter_prefix+p.RealName) then
|
|
||||||
jvm_create_setter_for_property(p,orgaccesspd);
|
|
||||||
{$endif jvm}
|
{$endif jvm}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user