From: Antoine ELIAS Date: Wed, 22 May 2013 07:55:51 +0000 (+0200) Subject: manage a=42 in parameter of macro X-Git-Tag: 6.0.0-alpha-1~1764 X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=commitdiff_plain;h=59d977573575d7c246b75f1c54db261365414497 manage a=42 in parameter of macro test_run core exists Change-Id: Iea41513137cdfd52944b4432cd0cbc4b1606452f --- diff --git a/scilab/modules/ast/includes/run_CallExp.hxx b/scilab/modules/ast/includes/run_CallExp.hxx index d7b7327..4778c10 100644 --- a/scilab/modules/ast/includes/run_CallExp.hxx +++ b/scilab/modules/ast/includes/run_CallExp.hxx @@ -53,6 +53,12 @@ void visitprivate(const CallExp &e) InternalType* pITR = result_get(); opt.push_back(std::pair(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++) diff --git a/scilab/modules/types/src/cpp/macro.cpp b/scilab/modules/types/src/cpp/macro.cpp index 765d706..36611a1 100644 --- a/scilab/modules/types/src/cpp/macro.cpp +++ b/scilab/modules/types/src/cpp/macro.cpp @@ -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); + } } }