hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-19 20:50:28 +0200
committerhachem <im@hachem.wtf>2026-09-19 20:50:28 +0200
commit6487b5b5301f6cb37c95c3571578d5a42adb2a1a (patch)
treebf90b803c6fa43058d54190fd1b52d835901bbcd /eval.c
parentc6aab10e74d58fbcad723c5f074a0bb51e9f2283 (diff)
feat: declval
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c9
1 files changed, 9 insertions, 0 deletions
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;