diff options
| author | gingerBill <bill@gingerbill.org> | 2018-05-27 10:49:14 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-05-27 10:49:14 +0100 |
| commit | 7ee9051a56ca0c04e6b60f53b9dfe47c75596496 (patch) | |
| tree | 619c13b7d86105fcfda13d315c0c315e7005630a /src/check_decl.cpp | |
| parent | eb11edabe092541144cd3ba18b09bd11fcf7a958 (diff) | |
IR now builds with the new package system
Diffstat (limited to 'src/check_decl.cpp')
| -rw-r--r-- | src/check_decl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 2626610de..db666da46 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -531,11 +531,15 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) { check_decl_attributes(c, d->attributes, proc_decl_attribute, &ac); } - e->deprecated_message = ac.deprecated_message; ac.link_name = handle_link_name(c, e->token, ac.link_name, ac.link_prefix); - if (d->scope->package != nullptr && e->token.string == "main") { + AstPackage *package = nullptr; + if (d->scope->parent && d->scope->parent->is_package) { + package = d->scope->parent->package; + } + + if (package != nullptr && e->token.string == "main") { if (pt->param_count != 0 || pt->result_count != 0) { gbString str = type_to_string(proc_type); @@ -547,7 +551,7 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) { error(e->token, "Procedure 'main' cannot have a custom calling convention"); } pt->calling_convention = ProcCC_Contextless; - if (d->scope->is_init) { + if (package->kind == ImportedPackage_Init) { if (c->info.entry_point != nullptr) { error(e->token, "Redeclaration of the entry pointer procedure 'main'"); } else { |