diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-06-21 17:49:05 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-06-21 17:49:05 +0100 |
| commit | 264ca00db72f56e2af8242a90e35a49b6ae13f86 (patch) | |
| tree | c7a1f170fea7c22b4d3734282716b0ee0e74ad7c /src/checker.cpp | |
| parent | 6b65ef6d8847ea7dcb23a556e12daae69738c5c2 (diff) | |
| parent | 5957d7f7bee7e5fac4035d47ecaaaad022adbfb8 (diff) | |
Merge branch 'master' of https://github.com/gingerBill/Odin
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index eaa38aaa4..c5b17cc2f 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -1779,14 +1779,16 @@ void check_all_global_entities(Checker *c) { continue; } - if (e->kind != Entity_Procedure && e->token.string == "main") { - if (e->scope->is_init) { + if (e->token.string == "main") { + if (e->kind != Entity_Procedure) { + if (e->scope->is_init) { + error(e->token, "`main` is reserved as the entry point procedure in the initial scope"); + continue; + } + } else if (e->scope->is_global) { error(e->token, "`main` is reserved as the entry point procedure in the initial scope"); continue; } - } else if (e->scope->is_global && e->token.string == "main") { - error(e->token, "`main` is reserved as the entry point procedure in the initial scope"); - continue; } CheckerContext prev_context = c->context; |