diff options
| author | gingerBill <bill@gingerbill.org> | 2024-04-26 13:25:08 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-04-26 13:25:08 +0100 |
| commit | a3e77dcc3bc4cf7d0548afa73d38914354761aa0 (patch) | |
| tree | 5c71048f33e4c1a87c6cb68b8e3af510b5e01bfe /src/checker.cpp | |
| parent | 7305478261700fc95f6748ba3091978a3fe7b1f3 (diff) | |
Minor clean up
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 116f275bc..f3e14eeba 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -4309,17 +4309,21 @@ gb_internal bool correct_single_type_alias(CheckerContext *c, Entity *e) { gb_internal bool correct_type_alias_in_scope_backwards(CheckerContext *c, Scope *s) { bool correction = false; - u32 n = s->elements.count; - for (u32 i = n-1; i < n; i--) { - correction |= correct_single_type_alias(c, s->elements.entries[i].value); + for (u32 n = s->elements.count, i = n-1; i < n; i--) { + Entity *e = s->elements.entries[i].value; + if (e != nullptr) { + correction |= correct_single_type_alias(c, e); + } } return correction; } gb_internal bool correct_type_alias_in_scope_forwards(CheckerContext *c, Scope *s) { bool correction = false; - u32 n = s->elements.count; - for (isize i = 0; i < n; i++) { - correction |= correct_single_type_alias(c, s->elements.entries[i].value); + for (auto const &entry : s->elements) { + Entity *e = entry.value; + if (e != nullptr) { + correction |= correct_single_type_alias(c, entry.value); + } } return correction; } |