Commit e2c0854c authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Preprocessor: removed useless version of DataTree::AddVariable()

parent 12ca3fe7
......@@ -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)
{
......
......@@ -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
......
......@@ -828,7 +828,7 @@ VariableNode::getChainRuleDerivative(int deriv_id, const map<int, NodeID> &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, vector<pair<int, pair<NodeID, Node
if (!is_endogenous_present_1 && !is_endogenous_present_2)
{
return (make_pair(0,
datatree.AddEqual(datatree.AddVariable(datatree.symbol_table.getName(datatree.symbol_table.getID(eEndogenous, var_endo)), 0), datatree.AddMinus(NodeID_2, NodeID_1))
datatree.AddEqual(datatree.AddVariable(datatree.symbol_table.getID(eEndogenous, var_endo), 0), datatree.AddMinus(NodeID_2, NodeID_1))
));
}
else if (is_endogenous_present_1 && is_endogenous_present_2)
{
return (make_pair(0,
datatree.AddEqual(datatree.AddVariable(datatree.symbol_table.getName(datatree.symbol_table.getID(eEndogenous, var_endo)), 0), datatree.Zero)
datatree.AddEqual(datatree.AddVariable(datatree.symbol_table.getID(eEndogenous, var_endo), 0), datatree.Zero)
));
}
else if (!is_endogenous_present_1 && is_endogenous_present_2)
{
return (make_pair(0,
datatree.AddEqual(datatree.AddVariable(datatree.symbol_table.getName(datatree.symbol_table.getID(eEndogenous, var_endo)), 0), /*datatree.AddUMinus(NodeID_1)*/ NodeID_1)
datatree.AddEqual(datatree.AddVariable(datatree.symbol_table.getID(eEndogenous, var_endo), 0), /*datatree.AddUMinus(NodeID_1)*/ NodeID_1)
));
}
else if (is_endogenous_present_1 && !is_endogenous_present_2)
{
return (make_pair(0,
datatree.AddEqual(datatree.AddVariable(datatree.symbol_table.getName(datatree.symbol_table.getID(eEndogenous, var_endo)), 0), NodeID_2)
datatree.AddEqual(datatree.AddVariable(datatree.symbol_table.getID(eEndogenous, var_endo), 0), NodeID_2)
));
}
break;
......
......@@ -250,7 +250,8 @@ ParsingDriver::add_expression_variable(string *name)
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);
int symb_id = mod_file->symbol_table.getID(*name);
NodeID id = data_tree->AddVariable(symb_id);
delete name;
return id;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment