manage a=42 in parameter of macro 56/11556/1
Antoine ELIAS [Wed, 22 May 2013 07:55:51 +0000 (09:55 +0200)]
test_run core exists

Change-Id: Iea41513137cdfd52944b4432cd0cbc4b1606452f

scilab/modules/ast/includes/run_CallExp.hxx
scilab/modules/types/src/cpp/macro.cpp

index d7b7327..4778c10 100644 (file)
@@ -53,6 +53,12 @@ void visitprivate(const CallExp &e)
                 InternalType* pITR = result_get();
 
                 opt.push_back(std::pair<std::wstring, InternalType*>(pVar->name_get().name_get(), pITR));
+                //in case of macro/macrofile, we have to shift input param
+                //so add NULL item in in list to keep initial order
+                if (pIT->isMacro() || pIT->isMacroFile())
+                {
+                    in.push_back(NULL);
+                }
                 continue;
             }
 
@@ -120,6 +126,11 @@ void visitprivate(const CallExp &e)
                         //clear input parameters
                         for (unsigned int k = 0; k < in.size(); k++)
                         {
+                            if (in[k] == NULL)
+                            {
+                                continue;
+                            }
+
                             in[k]->DecreaseRef();
                             if (in[k]->isDeletable())
                             {
@@ -157,7 +168,7 @@ void visitprivate(const CallExp &e)
             //clear input parameters
             for (unsigned int k = 0; k < in.size(); k++)
             {
-                if (in[k]->isDeletable())
+                if (in[k] && in[k]->isDeletable())
                 {
                     delete in[k];
                 }
@@ -178,6 +189,11 @@ void visitprivate(const CallExp &e)
         //clear input parameters but take care in case of in[k] == out[i]
         for (unsigned int k = 0; k < in.size(); k++)
         {
+            if (in[k] == NULL)
+            {
+                continue;
+            }
+
             //check if input data are use as output data
             bool bFind = false;
             for (int i = 0 ; i < out.size() ; i++)
index 765d706..36611a1 100644 (file)
@@ -159,7 +159,11 @@ Callable::ReturnValue Macro::call(typed_list &in, optional_list &opt, int _iRetC
 
         for (i = m_inputArgs->begin(), j = in.begin(); j != in.end (); ++j, ++i)
         {
-            pContext->put((*i), **j);
+            if (*j)
+            {
+                //prevent assignation of NULL value
+                pContext->put((*i), **j);
+            }
         }
     }