Add "pure" procedure types

This commit is contained in:
gingerBill
2020-05-23 13:38:06 +01:00
parent ef539696b9
commit aa029fe8d9
9 changed files with 72 additions and 17 deletions
+4 -1
View File
@@ -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;