compiler: fix strict private visibility check for nested types (issue #0018767)

git-svn-id: trunk@18999 -
This commit is contained in:
paul 2011-09-07 01:32:43 +00:00
parent 8c2eb2fa36
commit dd5aa12531
4 changed files with 44 additions and 4 deletions

2
.gitattributes vendored
View File

@ -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

View File

@ -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
View 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
View 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.