return(x) without assignation is not a correct expression
[scilab.git] / scilab / modules / ast / src / cpp / ast / runvisitor.cpp
index 4bc1f51..08ced71 100644 (file)
@@ -920,6 +920,11 @@ void RunVisitorT<T>::visitprivate(const ReturnExp &e)
     {
         //return(x)
 
+        if (e.getParent() == nullptr || e.getParent()->isAssignExp() == false)
+        {
+            CoverageInstance::stopChrono((void*)&e);
+            throw InternalError(_W("With input arguments, return / resume expect output arguments.\n"), 999, e.getLocation());
+        }
         //in case of CallExp, we can return only one values
         int iSaveExpectedSize = getExpectedSize();
         setExpectedSize(1);
@@ -935,6 +940,8 @@ void RunVisitorT<T>::visitprivate(const ReturnExp &e)
         setExpectedSize(iSaveExpectedSize);
         const_cast<ReturnExp*>(&e)->setReturn();
     }
+
+    CoverageInstance::stopChrono((void*)&e);
 }
 
 template <class T>