From a3619804370cfc7f1c6fa2ccd0f88314c844b08e Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Wed, 20 May 2015 12:24:55 +0200 Subject: [PATCH] preprocessor: move all dynamic model reindexing to DynamicModel --- DynamicModel.cc | 7 +++++++ DynamicModel.hh | 3 +++ ModFile.cc | 2 -- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/DynamicModel.cc b/DynamicModel.cc index 9e767fad..c5480aaa 100644 --- a/DynamicModel.cc +++ b/DynamicModel.cc @@ -4202,6 +4202,13 @@ DynamicModel::addStaticOnlyEquation(expr_t eq, int lineno) static_only_equations_lineno.push_back(lineno); } +void +DynamicModel::reindex(SymbolTable &orig_symbol_table) +{ + ModelTree::reindex(orig_symbol_table); + reindexStaticOnlyEquations(orig_symbol_table); +} + void DynamicModel::reindexStaticOnlyEquations(SymbolTable &orig_symbol_table) { diff --git a/DynamicModel.hh b/DynamicModel.hh index 835f09b7..7adda7fd 100644 --- a/DynamicModel.hh +++ b/DynamicModel.hh @@ -244,6 +244,9 @@ public: //! Adds an equation marked as [static] void addStaticOnlyEquation(expr_t eq, int lineno); + //! reindex Dynamic Model after removal of extra exogenous + void reindex(SymbolTable &orig_symbol_table); + //! reindex equations marked as [static] void reindexStaticOnlyEquations(SymbolTable &orig_symbol_table); diff --git a/ModFile.cc b/ModFile.cc index bc9cea5f..ceb68724 100644 --- a/ModFile.cc +++ b/ModFile.cc @@ -314,8 +314,6 @@ ModFile::transformPass(bool nostrict) SymbolTable orig_symbol_table = symbol_table; symbol_table.rmExo(unusedExo); dynamic_model.reindex(orig_symbol_table); - dynamic_model.reindexStaticOnlyEquations(orig_symbol_table); - external_functions_table.reindex(symbol_table, orig_symbol_table); vector orig_statements = statements;