From e2c0854cd4c33fa8a2aca09031075f9bd8503247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 16 Mar 2010 12:23:59 +0100 Subject: [PATCH] Preprocessor: removed useless version of DataTree::AddVariable() --- preprocessor/DataTree.cc | 7 ------- preprocessor/DataTree.hh | 2 -- preprocessor/ExprNode.cc | 10 +++++----- preprocessor/ParsingDriver.cc | 3 ++- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/preprocessor/DataTree.cc b/preprocessor/DataTree.cc index 3026b029e..a10080f24 100644 --- a/preprocessor/DataTree.cc +++ b/preprocessor/DataTree.cc @@ -72,13 +72,6 @@ DataTree::AddVariableInternal(int symb_id, int lag) return new VariableNode(*this, symb_id, lag); } -VariableNode * -DataTree::AddVariable(const string &name, int lag) -{ - int symb_id = symbol_table.getID(name); - return AddVariable(symb_id, lag); -} - VariableNode * DataTree::AddVariable(int symb_id, int lag) { diff --git a/preprocessor/DataTree.hh b/preprocessor/DataTree.hh index 5e6e9f15e..c4801164e 100644 --- a/preprocessor/DataTree.hh +++ b/preprocessor/DataTree.hh @@ -112,8 +112,6 @@ public: //! Adds a variable /*! The default implementation of the method refuses any lag != 0 */ virtual VariableNode *AddVariable(int symb_id, int lag = 0); - //! Adds a variable, using its symbol name - VariableNode *AddVariable(const string &name, int lag = 0); //! Adds "arg1+arg2" to model tree NodeID AddPlus(NodeID iArg1, NodeID iArg2); //! Adds "arg1-arg2" to model tree diff --git a/preprocessor/ExprNode.cc b/preprocessor/ExprNode.cc index 9a720b917..0d381ac5d 100644 --- a/preprocessor/ExprNode.cc +++ b/preprocessor/ExprNode.cc @@ -828,7 +828,7 @@ VariableNode::getChainRuleDerivative(int deriv_id, const map &recur NodeID VariableNode::toStatic(DataTree &static_datatree) const { - return static_datatree.AddVariable(datatree.symbol_table.getName(symb_id)); + return static_datatree.AddVariable(symb_id); } int @@ -2611,25 +2611,25 @@ BinaryOpNode::normalizeEquation(int var_endo, vectorsymbol_table.getType(*name) == eModelLocalVariable) error("Variable " + *name + " not allowed outside model declaration. Its scope is only inside model."); - NodeID id = data_tree->AddVariable(*name); + int symb_id = mod_file->symbol_table.getID(*name); + NodeID id = data_tree->AddVariable(symb_id); delete name; return id;