* 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:
Jonas Maebe 2013-01-30 22:36:03 +00:00
parent 8f96ace589
commit ddc03bdf03

View File

@ -332,9 +332,6 @@ implementation
hdef : tdef;
arraytype : tdef;
def : tdef;
{$ifdef jvm}
orgaccesspd : tprocdef;
{$endif}
pt : tnode;
sc : TFPObjectList;
paranr : word;
@ -346,6 +343,10 @@ implementation
storedprocdef: tprocvardef;
readprocdef,
writeprocdef : tprocdef;
{$ifdef jvm}
orgaccesspd : tprocdef;
wrongvisibility : boolean;
{$endif}
begin
{ Generate temp procdefs to search for matching read/write
procedures. the readprocdef will store all definitions }
@ -534,18 +535,20 @@ implementation
begin
{$ifdef jvm}
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
the visibility of the property, wrap it so that
we can call it from all contexts in which the
property is visible }
if (tprocdef(p.propaccesslist[palt_read].procdef).visibility<p.visibility) then
begin
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;
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);
else if wrongvisibility then
begin
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;
end;
{$endif jvm}
end;
end;
@ -615,18 +618,20 @@ implementation
begin
{$ifdef jvm}
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
the visibility of the property, wrap it so that
we can call it from all contexts in which the
property is visible }
if (tprocdef(p.propaccesslist[palt_write].procdef).visibility<p.visibility) then
else if wrongvisibility then
begin
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;
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}
end;
end;