* renamed the first parameter of is_owned_by() from "childdef" into

"nesteddef", because it's about def's owned by other defs, not about
    parent/child relations like in OOP
  * stop checking whether a def is owned by another one when we reach a
    para/localsymtable, since a type declared locally in a record/object
    method is not nested inside the record/object type (fixes mantis
    #23819)

git-svn-id: trunk@23582 -
This commit is contained in:
Jonas Maebe 2013-02-06 21:39:39 +00:00
parent 2b78bb1674
commit a972de5a32
3 changed files with 48 additions and 5 deletions

1
.gitattributes vendored
View File

@ -13184,6 +13184,7 @@ tests/webtbs/tw23725.pp svneol=native#text/pascal
tests/webtbs/tw23744.pp svneol=native#text/plain
tests/webtbs/tw2377.pp svneol=native#text/plain
tests/webtbs/tw2378.pp svneol=native#text/plain
tests/webtbs/tw23819.pp -text svneol=native#text/plain
tests/webtbs/tw2382.pp svneol=native#text/plain
tests/webtbs/tw2388.pp svneol=native#text/plain
tests/webtbs/tw2397.pp svneol=native#text/plain

View File

@ -223,7 +223,7 @@ interface
{*** Search ***}
procedure addsymref(sym:tsym);
function is_owned_by(childdef,ownerdef:tdef):boolean;
function is_owned_by(nesteddef,ownerdef:tdef):boolean;
function sym_is_owned_by(childsym:tsym;symtable:tsymtable):boolean;
function defs_belong_to_same_generic(def1,def2:tdef):boolean;
function get_generic_in_hierarchy_by_name(srsym:tsym;def:tdef):tdef;
@ -2070,11 +2070,15 @@ implementation
end;
function is_owned_by(childdef,ownerdef:tdef):boolean;
function is_owned_by(nesteddef,ownerdef:tdef):boolean;
begin
result:=childdef=ownerdef;
if not result and assigned(childdef.owner.defowner) then
result:=is_owned_by(tdef(childdef.owner.defowner),ownerdef);
result:=nesteddef=ownerdef;
if not result and
{ types declared locally in a record method are not defined in the
record itself }
not(nesteddef.owner.symtabletype in [localsymtable,parasymtable]) and
assigned(nesteddef.owner.defowner) then
result:=is_owned_by(tdef(nesteddef.owner.defowner),ownerdef);
end;
function sym_is_owned_by(childsym:tsym;symtable:tsymtable):boolean;

38
tests/webtbs/tw23819.pp Executable file
View File

@ -0,0 +1,38 @@
{ %norun }
program tw23819;
type
fixstring = string [ 255 ] ;
t9496 = ( t94, t96 ) ;
tSD = ( sdSingle94, sdSingle96, sdDOuble94, sdDouble96 ) ;
tg = ( G0, G1, G2, G3 ) ;
tG13 = G1..G3 ;
tl = #$40..#$7f ;
ESCstring = string [ 7 ] ;
tgl9496 = {packed} object
sd : tSD ;
g : tg ;
l : tl ;
n : t9496 ;
procedure Put ( const pESCseq : ESCstring ) ;
end ;
procedure tgl9496.Put ( const pESCseq : ESCstring ) ;
var
yp : tgl9496 ;
locals : record
Lst : FixString ;
gc : Char ;
gp,
letp : LongInt ;
xp : tgl9496 ;
end ;
begin
end ;
begin
end.