Bläddra i källkod

+ in some language modes the loop counter is undefined after the loop by language definition

git-svn-id: trunk@44043 -
florian 5 år sedan
förälder
incheckning
56d64b007f
1 ändrade filer med 7 tillägg och 0 borttagningar
  1. 7 0
      compiler/pstatmnt.pas

+ 7 - 0
compiler/pstatmnt.pas

@@ -507,6 +507,13 @@ implementation
                exclude(loopvarsym.varoptions,vo_is_loop_counter);
 
              result:=cfornode.create(hloopvar,hfrom,hto,hblock,backward);
+
+             { only in tp and mac pascal mode, we care about the value of the loop counter on loop exit
+
+               I am not sure though, if this is the right rule, at least in delphi the loop counter is undefined
+               on loop exit, we assume the same in all FPC modes }
+             if ([m_objfpc,m_fpc,m_delphi]*current_settings.modeswitches)<>[] then
+               Include(tfornode(Result).loopflags,lnf_dont_mind_loopvar_on_exit);
           end;