From 0f48a7d299a80c2e461bdcf5b37b5f624a48d7e8 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 14 Aug 2016 22:19:39 +0100 Subject: #foreign "custom_name"; bugs (see test.ll and test2.ll) --- src/checker/stmt.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'src/checker/stmt.cpp') diff --git a/src/checker/stmt.cpp b/src/checker/stmt.cpp index f3625def1..9b127b7aa 100644 --- a/src/checker/stmt.cpp +++ b/src/checker/stmt.cpp @@ -418,28 +418,12 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d, b32 check_body_later) { check_procedure_type(c, proc_type, pd->type); - b32 is_foreign = false; - b32 is_inline = false; - b32 is_no_inline = false; - for (AstNode *tag = pd->tag_list; tag != NULL; tag = tag->next) { - GB_ASSERT(tag->kind == AstNode_TagExpr); - - ast_node(te, TagExpr, tag); - String tag_name = te->name.string; - if (are_strings_equal(tag_name, make_string("foreign"))) { - is_foreign = true; - } else if (are_strings_equal(tag_name, make_string("inline"))) { - is_inline = true; - } else if (are_strings_equal(tag_name, make_string("no_inline"))) { - is_no_inline = true; - } else { - error(&c->error_collector, ast_node_token(tag), "Unknown procedure tag"); - } - // TODO(bill): Other tags - } + b32 is_foreign = (pd->tags & ProcTag_foreign) != 0; + b32 is_inline = (pd->tags & ProcTag_inline) != 0; + b32 is_no_inline = (pd->tags & ProcTag_no_inline) != 0; if (is_inline && is_no_inline) { - error(&c->error_collector, ast_node_token(pd->tag_list), + error(&c->error_collector, ast_node_token(pd->type), "You cannot apply both `inline` and `no_inline` to a procedure"); } -- cgit v1.2.3