Skip to content

Commit

Permalink
visitchildren
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Oct 28, 2024
1 parent 47b2932 commit 1ef4f27
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/solver/modelConverter/convertorVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Nodes::Node* convertExpressionToNode(
ExprParser::ExprContext* tree = parser.expr();

ConvertorVisitor visitor(registry, model);
auto a = visitor.visitChildren(tree);
auto a = visitor.visit(tree);
Nodes::Node* n;
return n;
}
Expand All @@ -58,11 +58,11 @@ ConvertorVisitor::ConvertorVisitor(

std::any ConvertorVisitor::visitChildren(antlr4::tree::ParseTree* node)
{
/* for (auto child: node->children) */
/* { */
/* child->accept(this); */
/* } */
return node->accept(this);
for (auto child: node->children)
{
child->accept(this);
}
return std::any();
}

std::any ConvertorVisitor::visit(antlr4::tree::ParseTree* tree)
Expand Down
9 changes: 5 additions & 4 deletions src/tests/src/solver/modelParser/testConvertorVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,23 @@

using namespace Antares::Solver;

BOOST_AUTO_TEST_CASE(simple_expression)
BOOST_AUTO_TEST_CASE(empty_expression)
{
ObjectModel::Model model;
Antares::Solver::Registry<Antares::Solver::Nodes::Node> registry;

std::string expression = "a * b";
std::string expression = "";

auto* node = ModelConverter::convertExpressionToNode(expression, registry, model);
}

BOOST_AUTO_TEST_CASE(empty_expression)
BOOST_AUTO_TEST_CASE(simple_expression)
{
ObjectModel::Model model;
Antares::Solver::Registry<Antares::Solver::Nodes::Node> registry;

std::string expression = "";
std::string expression = "a * b";

auto* node = ModelConverter::convertExpressionToNode(expression, registry, model);
}

0 comments on commit 1ef4f27

Please sign in to comment.