diff options
| author | gingerBill <bill@gingerbill.org> | 2020-05-23 13:38:06 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-05-23 13:38:06 +0100 |
| commit | aa029fe8d9d48477f0be27fa79f8c541451a8a0a (patch) | |
| tree | b15ec4c1364b527ac6337385b31998326ab85605 /src/check_type.cpp | |
| parent | ef539696b9540cc45a4343f0fecdb4bbcb1a8a0e (diff) | |
Add `"pure"` procedure types
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 3829694a0..d826860a6 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2452,6 +2452,7 @@ void set_procedure_abi_types(gbAllocator allocator, Type *type) { switch (type->Proc.calling_convention) { case ProcCC_Odin: case ProcCC_Contextless: + case ProcCC_Pure: if (is_type_pointer(new_type) & !is_type_pointer(e->type)) { e->flags |= EntityFlag_ImplicitReference; } @@ -2548,7 +2549,9 @@ bool check_procedure_type(CheckerContext *ctx, Type *type, Ast *proc_type_node, type->Proc.has_named_results = first->token.string != ""; } - + if (result_count == 0 && cc == ProcCC_Pure) { + error(proc_type_node, "\"pure\" procedures must have at least 1 return value"); + } bool optional_ok = (pt->tags & ProcTag_optional_ok) != 0; |