Skip to content

Commit

Permalink
Fix new dangling references.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Sep 4, 2023
1 parent 4dc631f commit 0f0c627
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/visitors/sympy_replace_solutions_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ void SympyReplaceSolutionsVisitor::visit_statement_block(ast::StatementBlock& no

void SympyReplaceSolutionsVisitor::try_replace_tagged_statement(
const ast::Node& node,
const std::shared_ptr<ast::Expression>& get_lhs(const ast::Node& node),
const std::shared_ptr<ast::Expression>& get_rhs(const ast::Node& node)) {
std::shared_ptr<ast::Expression> get_lhs(const ast::Node& node),
std::shared_ptr<ast::Expression> get_rhs(const ast::Node& node)) {
interleaves_counter.new_equation(true);

const auto& statement = std::static_pointer_cast<ast::Statement>(
Expand Down Expand Up @@ -212,11 +212,11 @@ void SympyReplaceSolutionsVisitor::try_replace_tagged_statement(

void SympyReplaceSolutionsVisitor::visit_diff_eq_expression(ast::DiffEqExpression& node) {
logger->debug("SympyReplaceSolutionsVisitor :: visit {}", to_nmodl(node));
auto get_lhs = [](const ast::Node& node) -> const std::shared_ptr<ast::Expression>& {
auto get_lhs = [](const ast::Node& node) -> std::shared_ptr<ast::Expression> {

Check warning on line 215 in src/visitors/sympy_replace_solutions_visitor.cpp

View check run for this annotation

Codecov / codecov/patch

src/visitors/sympy_replace_solutions_visitor.cpp#L215

Added line #L215 was not covered by tests
return dynamic_cast<const ast::DiffEqExpression&>(node).get_expression()->get_lhs();
};

auto get_rhs = [](const ast::Node& node) -> const std::shared_ptr<ast::Expression>& {
auto get_rhs = [](const ast::Node& node) -> std::shared_ptr<ast::Expression> {

Check warning on line 219 in src/visitors/sympy_replace_solutions_visitor.cpp

View check run for this annotation

Codecov / codecov/patch

src/visitors/sympy_replace_solutions_visitor.cpp#L219

Added line #L219 was not covered by tests
return dynamic_cast<const ast::DiffEqExpression&>(node).get_expression()->get_rhs();
};

Expand All @@ -225,11 +225,11 @@ void SympyReplaceSolutionsVisitor::visit_diff_eq_expression(ast::DiffEqExpressio

void SympyReplaceSolutionsVisitor::visit_lin_equation(ast::LinEquation& node) {
logger->debug("SympyReplaceSolutionsVisitor :: visit {}", to_nmodl(node));
auto get_lhs = [](const ast::Node& node) -> const std::shared_ptr<ast::Expression>& {
auto get_lhs = [](const ast::Node& node) -> std::shared_ptr<ast::Expression> {
return dynamic_cast<const ast::LinEquation&>(node).get_left_linxpression();
};

auto get_rhs = [](const ast::Node& node) -> const std::shared_ptr<ast::Expression>& {
auto get_rhs = [](const ast::Node& node) -> std::shared_ptr<ast::Expression> {
return dynamic_cast<const ast::LinEquation&>(node).get_left_linxpression();
};

Expand All @@ -239,11 +239,11 @@ void SympyReplaceSolutionsVisitor::visit_lin_equation(ast::LinEquation& node) {

void SympyReplaceSolutionsVisitor::visit_non_lin_equation(ast::NonLinEquation& node) {
logger->debug("SympyReplaceSolutionsVisitor :: visit {}", to_nmodl(node));
auto get_lhs = [](const ast::Node& node) -> const std::shared_ptr<ast::Expression>& {
auto get_lhs = [](const ast::Node& node) -> std::shared_ptr<ast::Expression> {

Check warning on line 242 in src/visitors/sympy_replace_solutions_visitor.cpp

View check run for this annotation

Codecov / codecov/patch

src/visitors/sympy_replace_solutions_visitor.cpp#L242

Added line #L242 was not covered by tests
return dynamic_cast<const ast::NonLinEquation&>(node).get_lhs();
};

auto get_rhs = [](const ast::Node& node) -> const std::shared_ptr<ast::Expression>& {
auto get_rhs = [](const ast::Node& node) -> std::shared_ptr<ast::Expression> {

Check warning on line 246 in src/visitors/sympy_replace_solutions_visitor.cpp

View check run for this annotation

Codecov / codecov/patch

src/visitors/sympy_replace_solutions_visitor.cpp#L246

Added line #L246 was not covered by tests
return dynamic_cast<const ast::NonLinEquation&>(node).get_rhs();
};

Expand Down
4 changes: 2 additions & 2 deletions src/visitors/sympy_replace_solutions_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ class SympyReplaceSolutionsVisitor: public AstVisitor {
*/
void try_replace_tagged_statement(
const ast::Node& node,
const std::shared_ptr<ast::Expression>& get_lhs(const ast::Node& node),
const std::shared_ptr<ast::Expression>& get_rhs(const ast::Node& node));
std::shared_ptr<ast::Expression> get_lhs(const ast::Node& node),
std::shared_ptr<ast::Expression> get_rhs(const ast::Node& node));

/**
* \struct InterleavesCounter
Expand Down

0 comments on commit 0f0c627

Please sign in to comment.