Răsfoiți Sursa

Fix for Mantis #26456.

symtable.pas, searchsym_in_helper:
  * check whether extendeddef is assigned as this function is called when parsing the extended type and it was not found (the second pass is to display a more accurate error message and was added some weeks ago)

+ added test

git-svn-id: trunk@28242 -
svenbarth 11 ani în urmă
părinte
comite
f1bfb398e4
3 a modificat fișierele cu 20 adăugiri și 1 ștergeri
  1. 1 0
      .gitattributes
  2. 3 1
      compiler/symtable.pas
  3. 16 0
      tests/webtbf/tw26456.pp

+ 1 - 0
.gitattributes

@@ -12774,6 +12774,7 @@ tests/webtbf/tw26176.pp svneol=native#text/pascal
 tests/webtbf/tw26193.pp svneol=native#text/pascal
 tests/webtbf/tw26363.pp svneol=native#text/plain
 tests/webtbf/tw26363a.pp svneol=native#text/plain
+tests/webtbf/tw26456.pp svneol=native#text/pascal
 tests/webtbf/tw2650.pp svneol=native#text/plain
 tests/webtbf/tw2657.pp svneol=native#text/plain
 tests/webtbf/tw2670.pp svneol=native#text/plain

+ 3 - 1
compiler/symtable.pas

@@ -2926,7 +2926,9 @@ implementation
               end;
           end;
         { now search in the extended type itself }
-        if classh.extendeddef.typ in [recorddef,objectdef] then
+        { Note: the extendeddef might be Nil if we are currently parsing the
+                extended type itself and the identifier was not found }
+        if assigned(classh.extendeddef) and (classh.extendeddef.typ in [recorddef,objectdef]) then
           begin
             srsymtable:=tabstractrecorddef(classh.extendeddef).symtable;
             srsym:=tsym(srsymtable.FindWithHash(hashedid));

+ 16 - 0
tests/webtbf/tw26456.pp

@@ -0,0 +1,16 @@
+{ %FAIL }
+
+program tw26456;
+{$modeswitch advancedrecords}
+type
+  THelper = record helper for xxxxxxx
+    procedure test;
+  end;
+
+  procedure THelper.test;
+  begin
+  end;
+
+begin
+end.
+