aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.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_type.cpp
parentef539696b9540cc45a4343f0fecdb4bbcb1a8a0e (diff)
Add `"pure"` procedure types
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp5
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;