Reset return flag while running ForExp 22/15922/4
Vincent COUVERT [Mon, 9 Feb 2015 14:09:45 +0000 (15:09 +0100)]
Change-Id: I2ee8407159d9e51c087705a7e0ccd3acba300e71

scilab/modules/ast/src/cpp/ast/runvisitor.cpp

index daa28f3..64c5996 100644 (file)
@@ -392,6 +392,7 @@ void RunVisitorT<T>::visitprivate(const ForExp  &e)
     //allow return operation
     if (e.isReturnable())
     {
+        const_cast<Exp&>(e.getBody()).resetReturn();
         const_cast<Exp&>(e.getBody()).setReturnable();
     }
 
@@ -420,6 +421,7 @@ void RunVisitorT<T>::visitprivate(const ForExp  &e)
             if (e.getBody().isReturn())
             {
                 const_cast<ForExp&>(e).setReturn();
+                const_cast<Exp&>(e.getBody()).resetReturn();
                 break;
             }
         }
@@ -449,6 +451,7 @@ void RunVisitorT<T>::visitprivate(const ForExp  &e)
             if (e.getBody().isReturn())
             {
                 const_cast<ForExp*>(&e)->setReturn();
+                const_cast<Exp&>(e.getBody()).resetReturn();
                 break;
             }
         }
@@ -492,6 +495,7 @@ void RunVisitorT<T>::visitprivate(const ForExp  &e)
             if (e.getBody().isReturn())
             {
                 const_cast<ForExp*>(&e)->setReturn();
+                const_cast<Exp&>(e.getBody()).resetReturn();
                 break;
             }
         }