compiler: don't search symbol in other symtables than in found nested class, fix wrong test + add another one

git-svn-id: trunk@21275 -
This commit is contained in:
paul 2012-05-12 08:21:50 +00:00
parent 62b59235ca
commit 62a91ef626
4 changed files with 27 additions and 9 deletions

1
.gitattributes vendored
View File

@ -10450,6 +10450,7 @@ 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/tclass13c.pp svneol=native#text/pascal
tests/test/tclass14a.pp svneol=native#text/pascal
tests/test/tclass14b.pp svneol=native#text/pascal
tests/test/tclass15.pp svneol=native#text/pascal

View File

@ -195,6 +195,7 @@ implementation
structstackindex: longint;
srsym: tsym;
srsymtable: tsymtable;
oldsymtablestack: TSymtablestack;
begin
if assigned(currentstructstack) then
structstackindex:=currentstructstack.count-1
@ -218,10 +219,14 @@ implementation
else
begin
structstackindex:=-1;
oldsymtablestack:=symtablestack;
symtablestack:=TSymtablestack.create;
symtablestack.push(tabstractrecorddef(def).symtable);
t2:=generrordef;
id_type(t2,isforwarddef,false,false,srsym,srsymtable);
symtablestack.pop(tabstractrecorddef(def).symtable);
symtablestack.free;
symtablestack:=oldsymtablestack;
def:=t2;
end;
end

View File

@ -18,16 +18,16 @@ type
FNode: TRootClass.TNode.TNode;
end;
en = (e1,e2);
TOtherNode = class
public
type
TNestedInOtherNode = class
ffield: longint;
TOtherNode = class
public
type
TNestedInOtherNode = class
ffield: longint;
end;
end;
TFinalNode = class
fx: TRootClass.TNode.TOtherNode.TNestedInOtherNode;
end;
end;
TFinalNode = class
fx: TRootClass.TOtherNode.TNestedInOtherNode;
end;
published
property Test: Integer read FTest write FTest;
end;

12
tests/test/tclass13c.pp Normal file
View File

@ -0,0 +1,12 @@
{ %norun }
{ %fail }
{$mode delphi}
type
TRootClass = class
Value: TRootClass.Integer;
end;
begin
end.