aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/check_decl.cpp')
-rw-r--r--src/check_decl.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index 401722148..f43d23c1c 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -425,9 +425,9 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
TypeProc *pt = &proc_type->Proc;
- bool is_foreign = (pl->tags & ProcTag_foreign) != 0;
+ bool is_foreign = e->Procedure.is_foreign;
+ bool is_export = (e->flags & EntityFlag_ForeignExport) != 0;
bool is_link_name = (pl->tags & ProcTag_link_name) != 0;
- bool is_export = (pl->tags & ProcTag_export) != 0;
bool is_inline = (pl->tags & ProcTag_inline) != 0;
bool is_no_inline = (pl->tags & ProcTag_no_inline) != 0;
bool is_require_results = (pl->tags & ProcTag_require_results) != 0;
@@ -489,7 +489,11 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
check_procedure_later(c, c->curr_ast_file, e->token, d, proc_type, pl->body, pl->tags);
}
} else if (!is_foreign) {
- error(e->token, "Only a foreign procedure cannot have a body");
+ if (e->flags & EntityFlag_ForeignExport) {
+ error(e->token, "Foreign export procedures must have a body");
+ } else {
+ error(e->token, "Only a foreign procedure cannot have a body");
+ }
}
if (pt->result_count == 0 && is_require_results) {