* allow accessing strict protected symbols from the extended struct inside

helpers (mantis #21811)

git-svn-id: trunk@22569 -
This commit is contained in:
Jonas Maebe 2012-10-06 20:31:43 +00:00
parent 283ff05127
commit 42f6caa0d1
3 changed files with 42 additions and 0 deletions

1
.gitattributes vendored
View File

@ -12851,6 +12851,7 @@ tests/webtbs/tw2176.pp svneol=native#text/plain
tests/webtbs/tw2177.pp svneol=native#text/plain
tests/webtbs/tw2178.pp svneol=native#text/plain
tests/webtbs/tw21808.pp svneol=native#text/plain
tests/webtbs/tw21811.pp svneol=native#text/plain
tests/webtbs/tw2185.pp svneol=native#text/plain
tests/webtbs/tw2186.pp svneol=native#text/plain
tests/webtbs/tw2187.pp svneol=native#text/plain

View File

@ -2177,6 +2177,12 @@ implementation
{ helpers can access strict protected symbols }
is_objectpascal_helper(contextobjdef) and
tobjectdef(contextobjdef).extendeddef.is_related(symownerdef)
) or
(
{ same as above, but from context of call node inside
helper method }
is_objectpascal_helper(current_structdef) and
tobjectdef(current_structdef).extendeddef.is_related(symownerdef)
);
end;
vis_protected :

35
tests/webtbs/tw21811.pp Normal file
View File

@ -0,0 +1,35 @@
{$mode objfpc}
type
TC1 = class
strict protected
procedure P;
end;
TH1 = class helper for TC1
public
procedure Q;
end;
var
b: boolean;
procedure TC1.P;
begin
b:=true;
end;
procedure TH1.Q;
begin
inherited P;
end;
var
c: tc1;
begin
b:=false;
c:=tc1.create;
c.q;
c.free;
if not b then
halt(1);
end.