Skip to content

Commit

Permalink
Fix variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
JCGoran committed Oct 24, 2024
1 parent 167d38f commit 4ce3d85
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/visitors/cvode_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ static std::pair<std::string, std::optional<int>> parse_independent_var(
return variable;
}

/// set of all indexed variables not equal to ``name``
/// set of all indexed variables not equal to ``ignored_name``
static std::unordered_set<std::string> get_indexed_variables(const ast::Expression& node,
const std::string& name) {
const std::string& ignored_name) {
std::unordered_set<std::string> indexed_variables;
// all of the "reserved" vars
auto reserved_symbols = get_external_functions();
Expand All @@ -60,7 +60,8 @@ static std::unordered_set<std::string> get_indexed_variables(const ast::Expressi
std::none_of(reserved_symbols.begin(),
reserved_symbols.end(),
[&varname](const auto item) { return varname == item; });
if (indexed_variables.count(varname) == 0 && varname != name && varname_not_reserved) {
if (indexed_variables.count(varname) == 0 && varname != ignored_name &&
varname_not_reserved) {
indexed_variables.insert(varname);
}
}
Expand Down

0 comments on commit 4ce3d85

Please sign in to comment.