Ver código fonte

* set successor of blocknodes properly

git-svn-id: trunk@25970 -
florian 11 anos atrás
pai
commit
1f05011113
1 arquivos alterados com 6 adições e 3 exclusões
  1. 6 3
      compiler/optutils.pas

+ 6 - 3
compiler/optutils.pas

@@ -186,15 +186,18 @@ unit optutils;
               begin
               begin
                 result:=p;
                 result:=p;
                 DoSet(tblocknode(p).statements,succ);
                 DoSet(tblocknode(p).statements,succ);
-                p.successor:=succ;
+                if assigned(tblocknode(p).statements) then
+                  p.successor:=tblocknode(p).statements
+                else
+                  p.successor:=succ;
               end;
               end;
             forn:
             forn:
               begin
               begin
                 Breakstack.Add(succ);
                 Breakstack.Add(succ);
                 Continuestack.Add(p);
                 Continuestack.Add(p);
                 result:=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;
                 p.successor:=succ;
                 Breakstack.Delete(Breakstack.Count-1);
                 Breakstack.Delete(Breakstack.Count-1);
                 Continuestack.Delete(Continuestack.Count-1);
                 Continuestack.Delete(Continuestack.Count-1);