From a4b994e4fff2ede509c6937cca6040161b5806bd Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Tue, 15 Oct 2024 11:08:43 +0200 Subject: [PATCH] SOLVE procedure. --- src/visitors/solve_block_visitor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) 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()); }