trunk preprocessor: added error message if model local variable (pound sign expression) used outside model scope

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2168 ac1d8469-bf42-47a9-8791-bf33cf982152
issue#70
sebastien 2008-10-17 12:22:35 +00:00
parent 0794065726
commit a8fa313ced
1 changed files with 4 additions and 0 deletions

View File

@ -196,6 +196,10 @@ ParsingDriver::add_expression_variable(string *name)
if (!mod_file->symbol_table.exists(*name))
mod_file->symbol_table.addSymbol(*name, eModFileLocalVariable);
// This check must come after the previous one!
if (mod_file->symbol_table.getType(*name) == eModelLocalVariable)
error("Variable " + *name + " not allowed outside model declaration. Its scope is only inside model.");
NodeID id = data_tree->AddVariable(*name);
delete name;