Selaa lähdekoodia

* fixed another case of endless recursion in
tabstractrecordsymtable.has_single_field(), due to always looking in the
symlist of the original record rather than properly recursing into those
of nested ones (mantis #28641)

git-svn-id: trunk@32618 -

Jonas Maebe 9 vuotta sitten
vanhempi
commit
0b4f3f01b3
3 muutettua tiedostoa jossa 31 lisäystä ja 3 poistoa
  1. 1 0
      .gitattributes
  2. 3 3
      compiler/symtable.pas
  3. 27 0
      tests/webtbs/tw28641.pp

+ 1 - 0
.gitattributes

@@ -14854,6 +14854,7 @@ tests/webtbs/tw2853e.pp svneol=native#text/plain
 tests/webtbs/tw2859.pp svneol=native#text/plain
 tests/webtbs/tw28593.pp svneol=native#text/plain
 tests/webtbs/tw28632.pp -text svneol=native#text/plain
+tests/webtbs/tw28641.pp svneol=native#text/plain
 tests/webtbs/tw2865.pp svneol=native#text/plain
 tests/webtbs/tw28650.pp svneol=native#text/pascal
 tests/webtbs/tw28674.pp svneol=native#text/pascal

+ 3 - 3
compiler/symtable.pas

@@ -1469,8 +1469,8 @@ implementation
           { record has one field? }
           for i:=0 to currentsymlist.Count-1 do
             begin
-              if (tsym(symlist[i]).typ=fieldvarsym) and
-                 not(sp_static in tsym(symlist[i]).symoptions) then
+              if (tsym(currentsymlist[i]).typ=fieldvarsym) and
+                 not(sp_static in tsym(currentsymlist[i]).symoptions) then
                 begin
                   if result then
                     begin
@@ -1478,7 +1478,7 @@ implementation
                       exit;
                     end;
                   result:=true;
-                  sym:=tfieldvarsym(symlist[i])
+                  sym:=tfieldvarsym(currentsymlist[i])
                 end;
             end;
           if assigned(sym) then

+ 27 - 0
tests/webtbs/tw28641.pp

@@ -0,0 +1,27 @@
+{ %norun }
+
+{$mode delphi}
+
+program Test;
+
+type
+  TMD5DigestHelper = record
+  public type
+    TMD5Buffer = array[0..63] of Byte;
+
+    TMD5Context = record
+      Buffer: TMD5Buffer;
+    end;
+  private
+    function Func_F(const X, Y, Z: LongWord): LongWord;
+  public
+    Context: TMD5Context;
+  end;
+
+function TMD5DigestHelper.Func_F(const X, Y, Z: LongWord): LongWord;
+begin
+  Result := (X and Y) or ((not X) and Z);
+end;
+
+begin
+end.