7#include "skeleton_node.hpp"
9namespace hi::inline
v1 {
14 statement_vector children;
21 formula_node const &function_declaration_expression) noexcept :
25 hi_assert(name_and_arguments.size() >= 1);
27 name = name_and_arguments[0];
28 name_and_arguments.erase(name_and_arguments.begin());
29 argument_names =
std::move(name_and_arguments);
31 super_function = context.set_function(
34 return this->evaluate_call(context, arguments);
37 throw operation_error(std::format(
"{}: Failed during handling of function call.\n{}", location, e.
what()));
52 if (ssize(children) > 0) {
53 children.back()->left_align();
56 context.push_super(super_function);
57 for (
hilet &child : children) {
58 child->post_process(context);
71 if (ssize(argument_names) != ssize(arguments)) {
72 throw operation_error(std::format(
73 "{}: Invalid number of arguments to function {}() expecting {} got {}.",
76 argument_names.
size(),
80 for (ssize_t i = 0; i != ssize(argument_names); ++i) {
81 context.set(argument_names[i], arguments[i]);
85 auto tmp = evaluate_children(context, children);
89 throw operation_error(std::format(
"{}: Found #break not inside a loop statement.", location));
91 }
else if (tmp.is_continue()) {
92 throw operation_error(std::format(
"{}: Found #continue not inside a loop statement.", location));
94 }
else if (tmp.is_undefined()) {
109 s += join(argument_names,
",");
#define hi_assert(expression,...)
Assert if expression is true.
Definition assert.hpp:184
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
DOXYGEN BUG.
Definition algorithm.hpp:13
A dynamic data type.
Definition datum.hpp:219
Definition formula_evaluation_context.hpp:15
void set_output_size(ssize_t new_size) noexcept
Set the size of the output.
Definition formula_evaluation_context.hpp:67
ssize_t output_size() const noexcept
Get the size of the output.
Definition formula_evaluation_context.hpp:59
Definition formula_node.hpp:28
virtual std::vector< std::string > get_name_and_argument_names() const
Get name and argument names from a function declaration.
Definition formula_node.hpp:115
Definition formula_post_process_context.hpp:19
Definition parse_location.hpp:18
Definition skeleton_function_node.hpp:11
datum evaluate(formula_evaluation_context &context) override
Evaluate the template.
Definition skeleton_function_node.hpp:63
bool append(std::unique_ptr< skeleton_node > x) noexcept override
Append a template-piece to the current template.
Definition skeleton_function_node.hpp:44
Definition skeleton_node.hpp:16