Unverified Commit 2781e3e6 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

A few modernizations using clang-tidy

parent 9274675e
Pipeline #4924 passed with stages
in 2 minutes and 25 seconds
...@@ -5995,8 +5995,8 @@ DynamicModel::writeJsonVariableMapping(ostream &output) const ...@@ -5995,8 +5995,8 @@ DynamicModel::writeJsonVariableMapping(ostream &output) const
auto [var, eqs] = *it; auto [var, eqs] = *it;
output << R"({"name": ")" << symbol_table.getName(var) << R"(", "equations":[)"; output << R"({"name": ")" << symbol_table.getName(var) << R"(", "equations":[)";
bool first_eq = true; bool first_eq = true;
for (auto it2 = eqs.begin(); it2 != eqs.end(); ++it2) for (int it2 : eqs)
if (auto tmp = equation_tags.getTagValueByEqnAndKey(*it2, "name"); if (auto tmp = equation_tags.getTagValueByEqnAndKey(it2, "name");
!tmp.empty()) !tmp.empty())
{ {
if (first_eq) if (first_eq)
......
/* /*
* Copyright © 2010-2019 Dynare Team * Copyright © 2010-2021 Dynare Team
* *
* This file is part of Dynare. * This file is part of Dynare.
* *
...@@ -274,7 +274,7 @@ SteadyStateModel::writeJsonSteadyStateFile(ostream &output, bool transformComput ...@@ -274,7 +274,7 @@ SteadyStateModel::writeJsonSteadyStateFile(ostream &output, bool transformComput
} }
if (symb_ids.size() > 1) if (symb_ids.size() > 1)
output << "]"; output << "]";
output << ", \"rhs\":\""; output << R"(, "rhs":")";
def_table[i].second->writeJsonOutput(output, {}, {}, false); def_table[i].second->writeJsonOutput(output, {}, {}, false);
output << "\"}" << endl; output << "\"}" << endl;
} }
......
/* /*
* Copyright © 2019 Dynare Team * Copyright © 2019-2021 Dynare Team
* *
* This file is part of Dynare. * This file is part of Dynare.
* *
...@@ -30,11 +30,11 @@ namespace macro ...@@ -30,11 +30,11 @@ namespace macro
class Environment class Environment
{ {
private: private:
const Environment *parent; const Environment *parent{nullptr};
map<string, ExpressionPtr> variables; map<string, ExpressionPtr> variables;
map<string, tuple<FunctionPtr, ExpressionPtr>> functions; map<string, tuple<FunctionPtr, ExpressionPtr>> functions;
public: public:
Environment() : parent{nullptr} { } Environment() = default;
Environment(const Environment *parent_arg) : parent{parent_arg} { } Environment(const Environment *parent_arg) : parent{parent_arg} { }
void define(VariablePtr var, ExpressionPtr value); void define(VariablePtr var, ExpressionPtr value);
void define(FunctionPtr func, ExpressionPtr value); void define(FunctionPtr func, ExpressionPtr value);
......
Markdown is supported
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