diff --git a/src/visitors/solve_block_visitor.cpp b/src/visitors/solve_block_visitor.cpp index 62ff7d085..4412a0b44 100644 --- a/src/visitors/solve_block_visitor.cpp +++ b/src/visitors/solve_block_visitor.cpp @@ -9,6 +9,7 @@ #include "utils/fmt.h" #include +#include #include "ast/all.hpp" #include "codegen/codegen_naming.hpp" @@ -67,6 +68,14 @@ ast::SolutionExpression* SolveBlockVisitor::create_solution_expression( return new ast::SolutionExpression(solve_block.clone(), callback_expr); } + if (node_to_solve->get_node_type() == ast::AstNodeType::PROCEDURE_BLOCK) { + auto procedure_call = new ast::FunctionCall(solve_block.get_block_name()->clone(), {}); + auto statement = std::make_shared(procedure_call); + auto statement_block = new ast::StatementBlock({statement}); + + return new ast::SolutionExpression(solve_block.clone(), statement_block); + } + auto block_to_solve = node_to_solve->get_statement_block(); return new ast::SolutionExpression(solve_block.clone(), block_to_solve->clone()); }