From fd923d428dd867b6bf19ffe80d7e1dea64c8ca64 Mon Sep 17 00:00:00 2001 From: Ferhat Mihoubi Date: Fri, 14 Oct 2011 14:35:32 +0200 Subject: [PATCH] Displays an error message when the model contains pound expressions and 'bytecode' or 'block' options are present --- DynamicModel.cc | 13 +++++++++++++ DynamicModel.hh | 1 + ModFile.cc | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/DynamicModel.cc b/DynamicModel.cc index e80d0a12..d4d37156 100644 --- a/DynamicModel.cc +++ b/DynamicModel.cc @@ -4175,3 +4175,16 @@ DynamicModel::fillEvalContext(eval_context_t &eval_context) const it != trendVars.end(); it++) eval_context[*it] = 2; //not <= 0 bc of log, not 1 bc of powers } + +bool +DynamicModel::isModelLocalVariableUsed() const +{ + set used_local_vars; + size_t i = 0; + while (i < equations.size() && used_local_vars.size() == 0) + { + equations[i]->collectModelLocalVariables(used_local_vars); + i++; + } + return used_local_vars.size() > 0; +} diff --git a/DynamicModel.hh b/DynamicModel.hh index 673ed862..d95deae8 100644 --- a/DynamicModel.hh +++ b/DynamicModel.hh @@ -476,6 +476,7 @@ public: else return (-1); }; + bool isModelLocalVariableUsed() const; }; #endif diff --git a/ModFile.cc b/ModFile.cc index c28f7d35..e9bce221 100644 --- a/ModFile.cc +++ b/ModFile.cc @@ -163,6 +163,13 @@ ModFile::checkPass() exit(EXIT_FAILURE); } + if (block || byte_code) + if (dynamic_model.isModelLocalVariableUsed()) + { + cerr << "ERROR: In 'model' block, 'block' or 'bytecode' options are not yet compatible with pound expressions" << endl; + exit(EXIT_FAILURE); + } + if ((stochastic_statement_present || mod_file_struct.check_present || mod_file_struct.steady_present) && no_static) { cerr << "ERROR: no_static option is incompatible with stoch_simul, estimation, osr, ramsey_policy, discretionary_policy, steady and check commands" << endl;