7#include "skeleton_node.hpp"
14 statement_vector children;
21 auto name_and_arguments = function_declaration_expression->get_name_and_argument_names();
22 tt_assert(name_and_arguments.size() >= 1);
24 name = name_and_arguments[0];
25 name_and_arguments.erase(name_and_arguments.begin());
26 argument_names =
std::move(name_and_arguments);
28 super_function = context.set_function(name,
31 return this->evaluate_call(context, arguments);
35 throw operation_error(
"Failed during handling of function call.\n{}", tt::to_string(e,
false));
49 if (std::ssize(children) > 0) {
50 children.back()->left_align();
53 context.push_super(super_function);
54 for (ttlet &child: children) {
55 child->post_process(context);
66 if (std::ssize(argument_names) != std::ssize(arguments)) {
67 tt_error_info().set<
"parse_location">(location);
68 throw operation_error(
"Invalid number of arguments to function {}() expecting {} got {}.", name, argument_names.
size(), arguments.
size());
71 for (ssize_t i = 0; i != std::ssize(argument_names); ++i) {
72 context.set(argument_names[i], arguments[i]);
76 auto tmp = evaluate_children(context, children);
80 tt_error_info().set<
"parse_location">(location);
81 throw operation_error(
"Found #break not inside a loop statement.");
83 }
else if (tmp.is_continue()) {
84 tt_error_info().set<
"parse_location">(location);
85 throw operation_error(
"Found #continue not inside a loop statement.");
87 }
else if (tmp.is_undefined()) {
101 s += join(argument_names,
",");
Error information passed alongside an error code or exception.
Definition error_info.hpp:81
error_info & set(Arg &&value) noexcept
Set an information for a given tag.
Definition error_info.hpp:144
Exception thrown during execution of a dynamic operation.
Definition exception.hpp:37
Definition formula_evaluation_context.hpp:16
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:60
Definition formula_post_process_context.hpp:18
Definition parse_location.hpp:16
Definition skeleton_function_node.hpp:11
bool append(std::unique_ptr< skeleton_node > x) noexcept override
Append a template-piece to the current template.
Definition skeleton_function_node.hpp:43
datum evaluate(formula_evaluation_context &context) override
Evaluate the template.
Definition skeleton_function_node.hpp:60
Definition skeleton_node.hpp:16