7#include "formula_node.hpp"
8#include "../macros.hpp"
10hi_export_module(hikogui.formula.formula_call_node);
12namespace hi {
inline namespace v1 {
19 formula_node(line_nr, column_nr), lhs(
std::move(lhs))
27 lhs->resolve_function_pointer(context);
28 for (
auto &arg : args) {
29 arg->post_process(context);
35 hilet args_ = transform<datum::vector_type>(args, [&](hilet &x) {
36 return x->evaluate(context);
39 return lhs->call(context, args_);
49 throw parse_error(std::format(
"Function definition does not have a name, got {}\n{}", *lhs, e.
what()));
52 for (hilet &arg : args) {
56 throw parse_error(std::format(
"Definition of function {}() has a non-name argument {}\n{}", *lhs, *arg, e.
what()));
65 auto s = std::format(
"({}(", *lhs);
67 for (hilet &arg : args) {
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
The HikoGUI API version 1.
Definition lookahead_iterator.hpp:6
A dynamic data type.
Definition datum.hpp:212
A temporary node used during parsing.
Definition formula_arguments.hpp:16
Definition formula_call_node.hpp:14
std::vector< std::string > get_name_and_argument_names() const override
Get name and argument names from a function declaration.
Definition formula_call_node.hpp:42
datum evaluate(formula_evaluation_context &context) const override
Evaluate an rvalue.
Definition formula_call_node.hpp:33
void post_process(formula_post_process_context &context) override
Resolve function and method pointers.
Definition formula_call_node.hpp:25
Definition formula_evaluation_context.hpp:18
Definition formula_post_process_context.hpp:237
Exception thrown during parsing on an error.
Definition exception_intf.hpp:47