Displays an error message when the model contains pound expressions and 'bytecode' or 'block' options are present

issue#70
Ferhat Mihoubi 2011-10-14 14:35:32 +02:00
parent b91dd27096
commit fd923d428d
3 changed files with 21 additions and 0 deletions

View File

@ -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<int> 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;
}

View File

@ -476,6 +476,7 @@ public:
else
return (-1);
};
bool isModelLocalVariableUsed() const;
};
#endif

View File

@ -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;