diff options
| author | gingerBill <bill@gingerbill.org> | 2017-11-04 10:53:47 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-11-04 10:53:47 +0000 |
| commit | 04b917a60aef2b60c6580899d191913004dbb2af (patch) | |
| tree | 88f674cdc19223e9d2fedf0ce5efb21fabd2092c /src/check_decl.cpp | |
| parent | e6c99cd2892cb34beaedfef0c8a786e2e0ef654e (diff) | |
More code clean up
Diffstat (limited to 'src/check_decl.cpp')
| -rw-r--r-- | src/check_decl.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index f8893eb67..7b71f43b6 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -478,8 +478,7 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) { bool is_export = e->Procedure.is_export; bool is_require_results = (pl->tags & ProcTag_require_results) != 0; - AttributeContext ac = {}; - ac.link_prefix = e->Procedure.link_prefix; + AttributeContext ac = make_attribute_context(e->Procedure.link_prefix); if (d != nullptr) { check_decl_attributes(c, d->attributes, proc_decl_attribute, &ac); @@ -552,12 +551,14 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) { pt->require_results = is_require_results; } - + if (ac.link_name.len > 0) { + e->Procedure.link_name = ac.link_name; + } if (is_foreign) { String name = e->token.string; - if (ac.link_name.len > 0) { - name = ac.link_name; + if (e->Procedure.link_name.len > 0) { + name = e->Procedure.link_name; } e->Procedure.is_foreign = true; e->Procedure.link_name = name; @@ -592,15 +593,11 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) { } } else { String name = e->token.string; - if (ac.link_name.len > 0) { - name = ac.link_name; + if (e->Procedure.link_name.len > 0) { + name = e->Procedure.link_name; } - - if (ac.link_name.len > 0 || is_export) { + if (e->Procedure.link_name.len > 0 || is_export) { auto *fp = &c->info.foreigns; - - e->Procedure.link_name = name; - HashKey key = hash_string(name); Entity **found = map_get(fp, key); if (found) { @@ -630,9 +627,7 @@ void check_var_decl(Checker *c, Entity *e, Entity **entities, isize entity_count } e->flags |= EntityFlag_Visited; - AttributeContext ac = {}; - ac.entity = e; - ac.link_prefix = e->Variable.link_prefix; + AttributeContext ac = make_attribute_context(e->Variable.link_prefix); ac.init_expr_list_count = init_expr_list.count; DeclInfo *decl = decl_info_of_entity(&c->info, e); @@ -641,7 +636,7 @@ void check_var_decl(Checker *c, Entity *e, Entity **entities, isize entity_count } ac.link_name = handle_link_name(c, e->token, ac.link_name, ac.link_prefix, ac.link_prefix_overridden); - + e->Variable.thread_local_model = ac.thread_local_model; String context_name = str_lit("variable declaration"); |