* when checking whether the current class definition finalises an existing

forward-declared class, only search the current symtable rather than the
    entire symtable stack (to prevent finding types in e.g. nested types)

git-svn-id: trunk@17128 -
This commit is contained in:
Jonas Maebe 2011-03-13 13:34:49 +00:00
parent c439d0107d
commit ac283bb237
3 changed files with 28 additions and 3 deletions

1
.gitattributes vendored
View File

@ -9531,6 +9531,7 @@ tests/test/tclass12c.pp svneol=native#text/pascal
tests/test/tclass12d.pp svneol=native#text/plain
tests/test/tclass13.pp svneol=native#text/pascal
tests/test/tclass13a.pp svneol=native#text/plain
tests/test/tclass13b.pp svneol=native#text/plain
tests/test/tclass14a.pp svneol=native#text/pascal
tests/test/tclass14b.pp svneol=native#text/pascal
tests/test/tclass2.pp svneol=native#text/plain

View File

@ -397,7 +397,6 @@ implementation
typename,orgtypename : TIDString;
newtype : ttypesym;
sym : tsym;
srsymtable : TSymtable;
hdef : tdef;
defpos,storetokenpos : tfileposinfo;
old_block_type : tblock_type;
@ -462,8 +461,10 @@ implementation
current_scanner.startrecordtokens(generictokenbuf);
end;
{ is the type already defined? }
searchsym(typename,sym,srsymtable);
{ is the type already defined? -- must be in the current symtable,
not in a nested symtable or one higher up the stack -> don't
use searchsym & frinds! }
sym:=tsym(symtablestack.top.find(typename));
newtype:=nil;
{ found a symbol with this name? }
if assigned(sym) then

23
tests/test/tclass13b.pp Normal file
View File

@ -0,0 +1,23 @@
{ %norun }
{$mode delphi}
type
tc = class
type
tforward = class;
tnested = class
type
tforward = class;
tforward = class
end;
end;
tforward = class
end;
end;
begin
end.