hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index eddeb6b..b0ad454 100644
--- a/eval.c
+++ b/eval.c
@@ -168,11 +168,27 @@ static enum RunStatus emit(const struct Node* node)
return RUN_DONE;
}
+static enum RunStatus static_assert_statement(const struct Node* node)
+{
+ bool truth = false;
+ if (evaluate_condition(node->first, &truth))
+ return RUN_FAILED;
+
+ if (!truth)
+ {
+ (void)complain(node, "static assertion failed, at runtime, which is the best time");
+ return RUN_FAILED;
+ }
+
+ return RUN_DONE;
+}
+
static enum RunStatus execute_one(const struct Node* node)
{
switch (node->kind)
{
case STMT_EMIT: return emit(node);
+ case STMT_STATIC_ASSERT: return static_assert_statement(node);
default: break;
}