diff options
| author | hachem <im@hachem.wtf> | 2026-09-19 20:50:28 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-19 20:50:28 +0200 |
| commit | 6487b5b5301f6cb37c95c3571578d5a42adb2a1a (patch) | |
| tree | bf90b803c6fa43058d54190fd1b52d835901bbcd /eval.c | |
| parent | c6aab10e74d58fbcad723c5f074a0bb51e9f2283 (diff) | |
feat: declval
Diffstat (limited to 'eval.c')
| -rw-r--r-- | eval.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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; |
