aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-05-23 13:38:06 +0100
committergingerBill <bill@gingerbill.org>2020-05-23 13:38:06 +0100
commitaa029fe8d9d48477f0be27fa79f8c541451a8a0a (patch)
treeb15ec4c1364b527ac6337385b31998326ab85605 /src/check_stmt.cpp
parentef539696b9540cc45a4343f0fecdb4bbcb1a8a0e (diff)
Add `"pure"` procedure types
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 6672ea204..e357d366d 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -1301,6 +1301,11 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) {
case_end;
case_ast_node(as, AssignStmt, node);
+ if (ctx->curr_proc_calling_convention == ProcCC_Pure) {
+ error(node, "Assignment statements are not allowed within a \"pure\" procedure");
+ // Continue
+ }
+
switch (as->op.kind) {
case Token_Eq: {
// a, b, c = 1, 2, 3; // Multisided
@@ -2027,6 +2032,12 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) {
check_arity_match(ctx, vd);
check_init_variables(ctx, entities, entity_count, vd->values, str_lit("variable declaration"));
+ if (ctx->curr_proc_calling_convention == ProcCC_Pure) {
+ if (vd->values.count == 0) {
+ error(node, "Variable declarations without assignment are not allowed within \"pure\" procedures");
+ }
+ }
+
for (isize i = 0; i < entity_count; i++) {
Entity *e = entities[i];