Explorar o código

* set successor of blocknodes properly

git-svn-id: trunk@25970 -
florian %!s(int64=11) %!d(string=hai) anos
pai
achega
1f05011113
Modificáronse 1 ficheiros con 6 adicións e 3 borrados
  1. 6 3
      compiler/optutils.pas

+ 6 - 3
compiler/optutils.pas

@@ -186,15 +186,18 @@ unit optutils;
               begin
                 result:=p;
                 DoSet(tblocknode(p).statements,succ);
-                p.successor:=succ;
+                if assigned(tblocknode(p).statements) then
+                  p.successor:=tblocknode(p).statements
+                else
+                  p.successor:=succ;
               end;
             forn:
               begin
                 Breakstack.Add(succ);
                 Continuestack.Add(p);
                 result:=p;
-                { the successor of the last node of the for body is the for node itself }
-                DoSet(tfornode(p).t2,p);
+                { the successor of the last node of the for body is the body itself }
+                DoSet(tfornode(p).t2,tfornode(p).t2);
                 p.successor:=succ;
                 Breakstack.Delete(Breakstack.Count-1);
                 Continuestack.Delete(Continuestack.Count-1);