11struct skeleton_block_node final : skeleton_node {
13 statement_vector children;
15 formula_post_process_context::function_type function;
16 formula_post_process_context::function_type super_function;
28 return this->evaluate_call(context, arguments);
42 if (ssize(children) > 0) {
43 children.back()->left_align();
46 function = context.get_function(name);
49 context.push_super(super_function);
50 for (hilet &child : children) {
51 child->post_process(context);
60 tmp = function(context, datum::vector_type{});
63 throw operation_error(std::format(
"{}: Could not evaluate block.\n{}", location, e.
what()));
67 throw operation_error(std::format(
"{}: Found #break not inside a loop statement.", location));
70 throw operation_error(std::format(
"{}: Found #continue not inside a loop statement.", location));
76 throw operation_error(std::format(
"{}: Can not use a #return statement inside a #block.", location));
83 auto tmp = evaluate_children(context, children);
87 throw operation_error(std::format(
"{}: Found #break not inside a loop statement.", location));
89 }
else if (tmp.is_continue()) {
90 throw operation_error(std::format(
"{}: Found #continue not inside a loop statement.", location));
92 }
else if (tmp.is_undefined()) {
96 throw operation_error(std::format(
"{}: Can not use a #return statement inside a #block.", location));
100 std::string string() const noexcept
override
102 std::string s =
"<block ";
104 s += join(transform<std::vector<std::string>>(children, [](
auto &x) {
#define hi_assert(expression,...)
Assert if expression is true.
Definition assert.hpp:199
bool append(std::unique_ptr< skeleton_node > x) noexcept override
Append a template-piece to the current template.
Definition skeleton_block_node.hpp:34