diff options
Diffstat (limited to 'eval.c')
| -rw-r--r-- | eval.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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; } |
