mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 16:09:31 +02:00
* allow accessing strict protected symbols from the extended struct inside
helpers (mantis #21811) git-svn-id: trunk@22569 -
This commit is contained in:
parent
283ff05127
commit
42f6caa0d1
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
35
tests/webtbs/tw21811.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user