7#include "formula_binary_operator_node.hpp"
8#include "../macros.hpp"
10hi_export_module(hikogui.formula.formula_member_node);
12namespace hi {
inline namespace v1 {
15 mutable formula_post_process_context::method_type method;
22 if (rhs_name ==
nullptr) {
23 throw parse_error(std::format(
"{}:{}: Expecting a name token on the right hand side of a member accessor. got {}.", line_nr, column_nr, *rhs));
29 method =
context.get_method(rhs_name->name);
31 throw parse_error(std::format(
"{}:{}: Could not find method .{}().", line_nr, column_nr, rhs_name->name));
37 if (lhs->has_evaluate_xvalue()) {
40 if (!
lhs_.contains(rhs_name->name)) {
41 throw operation_error(std::format(
"{}:{}: Unknown attribute .{}", line_nr, column_nr, rhs_name->name));
44 return lhs_[rhs_name->name];
46 throw operation_error(std::format(
"{}:{}: Can not evaluate member selection.\n{}", line_nr, column_nr, e.
what()));
52 if (!
lhs_.contains(rhs_name->name)) {
53 throw operation_error(std::format(
"{}:{}: Unknown attribute .{}", line_nr, column_nr, rhs_name->name));
56 return lhs_[rhs_name->name];
58 throw operation_error(std::format(
"{}:{}: Can not evaluate member selection.\n{}", line_nr, column_nr, e.
what()));
67 return lhs_[rhs_name->name];
69 throw operation_error(std::format(
"{}:{}: Can not evaluate member-selection.\n{}", line_nr, column_nr, e.
what()));
79 throw operation_error(std::format(
"{}:{}: Can not evaluate call-of-method.\n{}", line_nr, column_nr, e.
what()));
85 return std::format(
"({} . {})", *lhs, *rhs);
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
A dynamic data type.
Definition datum.hpp:212
Definition formula_binary_operator_node.hpp:14
Definition formula_evaluation_context.hpp:18
Definition formula_member_node.hpp:14
datum evaluate(formula_evaluation_context &context) const override
Evaluate an rvalue.
Definition formula_member_node.hpp:35
void resolve_function_pointer(formula_post_process_context &context) override
Resolve function and method pointers.
Definition formula_member_node.hpp:27
datum call(formula_evaluation_context &context, datum::vector_type const &arguments) const override
Call a function with a datum::vector as arguments.
Definition formula_member_node.hpp:73
datum & evaluate_lvalue(formula_evaluation_context &context) const override
Evaluate an existing lvalue.
Definition formula_member_node.hpp:63
Definition formula_name_node.hpp:14
Definition formula_post_process_context.hpp:237
Exception thrown during parsing on an error.
Definition exception_intf.hpp:47
Exception thrown during execution of a dynamic operation.
Definition exception_intf.hpp:160