* Bug 16191 fixed: now mode(0) and mode(1) are really compact.
[scilab.git] / scilab / modules / ast / src / cpp / ast / runvisitor.cpp
index 2641228..dc7d63d 100644 (file)
@@ -126,7 +126,10 @@ void RunVisitorT<T>::visitprivate(const SimpleVar & e)
             ostr << L"(" << pI->getRef() << L")";
 #endif
             ostr << std::endl;
-            ostr << std::endl;
+            if (ConfigVariable::isPrintCompact() == false)
+            {
+                ostr << std::endl;                
+            }
             scilabWriteW(ostr.str().c_str());
             std::wostringstream ostrName;
             ostrName << e.getSymbol().getName();
@@ -522,8 +525,8 @@ void RunVisitorT<T>::visitprivate(const IfExp  &e)
         throw;
     }
 
-    bool elseIsContinue = e.hasElse() && (&e.getElse())->isContinue();
-    if (e.isBreakable() && (elseIsContinue || (&e.getThen())->isBreak()))
+    bool elseIsBreak = e.hasElse() && (&e.getElse())->isBreak();
+    if (e.isBreakable() && (elseIsBreak || (&e.getThen())->isBreak()))
     {
         const_cast<IfExp*>(&e)->setBreak();
         const_cast<Exp*>(&e.getThen())->resetBreak();
@@ -533,6 +536,7 @@ void RunVisitorT<T>::visitprivate(const IfExp  &e)
         }
     }
 
+    bool elseIsContinue = e.hasElse() && (&e.getElse())->isContinue();
     if (e.isContinuable() && (elseIsContinue || (&e.getThen())->isContinue()))
     {
         const_cast<IfExp*>(&e)->setContinue();
@@ -544,8 +548,7 @@ void RunVisitorT<T>::visitprivate(const IfExp  &e)
     }
 
     bool elseIsReturn = e.hasElse() && (&e.getElse())->isReturn();
-    if (e.isReturnable()
-            && (elseIsReturn || (&e.getThen())->isReturn()))
+    if (e.isReturnable() && (elseIsReturn || (&e.getThen())->isReturn()))
     {
         const_cast<IfExp*>(&e)->setReturn();
         const_cast<Exp*>(&e.getThen())->resetReturn();
@@ -902,13 +905,6 @@ void RunVisitorT<T>::visitprivate(const ReturnExp &e)
     {
         if (ConfigVariable::getPauseLevel() != 0 && symbol::Context::getInstance()->getScopeLevel() == ConfigVariable::getActivePauseLevel())
         {
-            if (ConfigVariable::getEnableDebug() == true)
-            {
-                sciprint(_("%s: function is disabled in debug mode.\n"), "resume");
-                CoverageInstance::stopChrono((void*)&e);
-                return;
-            }
-
             //return or resume
             ConfigVariable::DecreasePauseLevel();
             ConfigVariable::macroFirstLine_end();
@@ -1423,6 +1419,10 @@ void RunVisitorT<T>::visitprivate(const FunctionDec & e)
     types::Macro *pMacro = new types::Macro(e.getSymbol().getName(), *pVarList, *pRetList,
                                             const_cast<SeqExp&>(static_cast<const SeqExp&>(e.getBody())), L"script");
     pMacro->setLines(e.getLocation().first_line, e.getLocation().last_line);
+    if (e.getMacro())
+    {
+        pMacro->setFileName(e.getMacro()->getFileName());
+    }
 
     if (ctx->isprotected(symbol::Symbol(pMacro->getName())))
     {