diff options
| author | gingerBill <bill@gingerbill.org> | 2022-12-20 14:19:55 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-12-20 14:19:55 +0000 |
| commit | 8fc9566a837fbd3fe52f3f1b5e766e122b3c2de2 (patch) | |
| tree | 8a511e3d57e8f27ed0d98dde37d060eb68437755 /src/checker.cpp | |
| parent | 134c7db4d21e80751833ed45fb4ace5d0ae3b7d2 (diff) | |
Use `*_set_update` where possible
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 7cafcea2e..14a0e5f4c 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -3414,11 +3414,9 @@ gb_internal void check_decl_attributes(CheckerContext *c, Array<Ast *> const &at continue; } - if (string_set_exists(&set, name)) { + if (string_set_update(&set, name)) { error(elem, "Previous declaration of '%.*s'", LIT(name)); continue; - } else { - string_set_add(&set, name); } if (!proc(c, elem, name, value, ac)) { @@ -4969,10 +4967,9 @@ gb_internal Array<Entity *> find_entity_path(Entity *start, Entity *end, PtrSet< Array<Entity *> empty_path = {}; - if (ptr_set_exists(visited, start)) { + if (ptr_set_update(visited, start)) { return empty_path; } - ptr_set_add(visited, start); DeclInfo *decl = start->decl_info; if (decl) { |