Browse Source

compiler: allow "with" to search members in nested types properly

git-svn-id: trunk@18987 -
paul 14 years ago
parent
commit
7dd8a97487
4 changed files with 29 additions and 2 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/htypechk.pas
  3. 1 1
      compiler/symtable.pas
  4. 26 0
      tests/test/tclass15.pp

+ 1 - 0
.gitattributes

@@ -9904,6 +9904,7 @@ tests/test/tclass13a.pp svneol=native#text/plain
 tests/test/tclass13b.pp svneol=native#text/plain
 tests/test/tclass13b.pp svneol=native#text/plain
 tests/test/tclass14a.pp svneol=native#text/pascal
 tests/test/tclass14a.pp svneol=native#text/pascal
 tests/test/tclass14b.pp svneol=native#text/pascal
 tests/test/tclass14b.pp svneol=native#text/pascal
+tests/test/tclass15.pp svneol=native#text/pascal
 tests/test/tclass2.pp svneol=native#text/plain
 tests/test/tclass2.pp svneol=native#text/plain
 tests/test/tclass3.pp svneol=native#text/plain
 tests/test/tclass3.pp svneol=native#text/plain
 tests/test/tclass4.pp svneol=native#text/plain
 tests/test/tclass4.pp svneol=native#text/plain

+ 1 - 1
compiler/htypechk.pas

@@ -2047,7 +2047,7 @@ implementation
             ((FProcSymtable.symtabletype=withsymtable) and
             ((FProcSymtable.symtabletype=withsymtable) and
              (FProcSymtable.defowner.typ in [objectdef,recorddef]))
              (FProcSymtable.defowner.typ in [objectdef,recorddef]))
            ) and
            ) and
-           (FProcSymtable.defowner.owner.symtabletype in [globalsymtable,staticsymtable]) and
+           (FProcSymtable.defowner.owner.symtabletype in [globalsymtable,staticsymtable,objectsymtable,recordsymtable]) and
            FProcSymtable.defowner.owner.iscurrentunit then
            FProcSymtable.defowner.owner.iscurrentunit then
           contextstructdef:=tabstractrecorddef(FProcSymtable.defowner)
           contextstructdef:=tabstractrecorddef(FProcSymtable.defowner)
         else
         else

+ 1 - 1
compiler/symtable.pas

@@ -1994,7 +1994,7 @@ implementation
                     if (srsymtable.symtabletype=withsymtable) and
                     if (srsymtable.symtabletype=withsymtable) and
                        assigned(srsymtable.defowner) and
                        assigned(srsymtable.defowner) and
                        (srsymtable.defowner.typ in [recorddef,objectdef]) and
                        (srsymtable.defowner.typ in [recorddef,objectdef]) and
-                       (srsymtable.defowner.owner.symtabletype in [globalsymtable,staticsymtable]) and
+                       (srsymtable.defowner.owner.symtabletype in [globalsymtable,staticsymtable,objectsymtable,recordsymtable]) and
                        (srsymtable.defowner.owner.iscurrentunit) then
                        (srsymtable.defowner.owner.iscurrentunit) then
                       contextstructdef:=tabstractrecorddef(srsymtable.defowner)
                       contextstructdef:=tabstractrecorddef(srsymtable.defowner)
                     else
                     else

+ 26 - 0
tests/test/tclass15.pp

@@ -0,0 +1,26 @@
+{ %norun }
+program tclass15;
+
+{$MODE DELPHI}
+
+uses
+  Classes;
+
+type
+  TMyClass=class
+  private
+  type
+    TMyMemoryStream=class(TCustomMemoryStream) end;
+  public
+    procedure MyProc;
+  end;
+
+procedure TMyClass.MyProc;
+begin
+  with TMyMemoryStream.Create do
+    SetPointer(nil,0)
+end;
+
+begin
+end.
+