mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-02 12:42:49 +02:00
compiler: fix strict private visibility check for nested types (issue #0018767)
git-svn-id: trunk@18999 -
This commit is contained in:
parent
8c2eb2fa36
commit
dd5aa12531
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -11712,6 +11712,8 @@ tests/webtbs/tw1867.pp svneol=native#text/plain
|
||||
tests/webtbs/tw18690.pp svneol=native#text/plain
|
||||
tests/webtbs/tw18702.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw1873.pp svneol=native#text/plain
|
||||
tests/webtbs/tw18767a.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw18767b.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw1883.pp svneol=native#text/plain
|
||||
tests/webtbs/tw18859.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1888.pp svneol=native#text/plain
|
||||
|
@ -217,7 +217,7 @@ interface
|
||||
|
||||
{*** Search ***}
|
||||
procedure addsymref(sym:tsym);
|
||||
function is_owned_by(childdef,ownerdef:tabstractrecorddef):boolean;
|
||||
function is_owned_by(childdef,ownerdef:tdef):boolean;
|
||||
function is_visible_for_object(symst:tsymtable;symvisibility:tvisibility;contextobjdef:tabstractrecorddef):boolean;
|
||||
function is_visible_for_object(pd:tprocdef;contextobjdef:tabstractrecorddef):boolean;
|
||||
function is_visible_for_object(sym:tsym;contextobjdef:tabstractrecorddef):boolean;
|
||||
@ -1829,11 +1829,11 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function is_owned_by(childdef,ownerdef:tabstractrecorddef):boolean;
|
||||
function is_owned_by(childdef,ownerdef:tdef):boolean;
|
||||
begin
|
||||
result:=childdef=ownerdef;
|
||||
if not result and (childdef.owner.symtabletype in [ObjectSymtable,recordsymtable]) then
|
||||
result:=is_owned_by(tabstractrecorddef(childdef.owner.defowner),ownerdef);
|
||||
if not result and assigned(childdef.owner.defowner) then
|
||||
result:=is_owned_by(tdef(childdef.owner.defowner),ownerdef);
|
||||
end;
|
||||
|
||||
function is_visible_for_object(symst:tsymtable;symvisibility:tvisibility;contextobjdef:tabstractrecorddef):boolean;
|
||||
|
19
tests/webtbs/tw18767a.pp
Normal file
19
tests/webtbs/tw18767a.pp
Normal file
@ -0,0 +1,19 @@
|
||||
{ %norun}
|
||||
program tw18767a.pp;
|
||||
|
||||
{$mode delphi}{$H+}
|
||||
|
||||
type
|
||||
TFoo = class
|
||||
strict private
|
||||
const
|
||||
n = 3;
|
||||
var
|
||||
x: array[0..1] of record
|
||||
y: array[0..n] of integer;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
TFoo.Create;
|
||||
end.
|
19
tests/webtbs/tw18767b.pp
Normal file
19
tests/webtbs/tw18767b.pp
Normal file
@ -0,0 +1,19 @@
|
||||
{ %norun}
|
||||
program tw18767b;
|
||||
|
||||
{$mode delphi}{$H+}
|
||||
|
||||
type
|
||||
TFoo = class
|
||||
strict private
|
||||
type
|
||||
TBar = (one, two);
|
||||
var
|
||||
x: array of record
|
||||
y: array[TBar] of integer;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
TFoo.Create;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user