From 6487b5b5301f6cb37c95c3571578d5a42adb2a1a Mon Sep 17 00:00:00 2001 From: hachem Date: Sat, 19 Sep 2026 20:50:28 +0200 Subject: feat: declval --- eval.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'eval.c') diff --git a/eval.c b/eval.c index c872c90..aeae982 100644 --- a/eval.c +++ b/eval.c @@ -121,6 +121,15 @@ static int evaluate_value(struct Machine* machine, const struct Node* node, int6 *out = variable->value; return 0; + case VALUE_DECLVAL: + if (evaluate_type(machine, node->first, &type)) + return 1; + + if (type.kind != KIND_VALUE) + return complain(node, "declval of a type with no value in it, what did you expect"); + + *out = type.number; + return 0; case VALUE_CONDITIONAL: if (evaluate_condition(machine, node->first, &truth)) return 1; -- cgit v1.3