2
0
Эх сурвалжийг харах

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

git-svn-id: trunk@21275 -
paul 13 жил өмнө
parent
commit
62a91ef626

+ 1 - 0
.gitattributes

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

+ 5 - 0
compiler/ptype.pas

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

+ 9 - 9
tests/test/tclass13.pp

@@ -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 - 0
tests/test/tclass13c.pp

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