mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-06 06:38:20 +00:00
Fix scope->elements iteration causing a few bugs in the doc-format
This commit is contained in:
@@ -788,11 +788,17 @@ gb_internal bool check_using_stmt_entity(CheckerContext *ctx, AstUsingStmt *us,
|
||||
rw_mutex_lock(&scope->mutex);
|
||||
defer (rw_mutex_unlock(&scope->mutex));
|
||||
|
||||
for (auto const &entry : scope->elements) {
|
||||
Entity *decl = entry.value;
|
||||
if (!is_entity_exported(decl, true)) continue;
|
||||
u32 hash = entry.hash;
|
||||
auto interned = scope->elements.keys[hash & (scope->elements.cap-1)];
|
||||
for (u32 i = 0; i < scope->elements.cap; i++) {
|
||||
if (!scope->elements.slots[i].hash) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Entity *decl = scope->elements.slots[i].value;
|
||||
if (!is_entity_exported(decl, true)) {
|
||||
continue;
|
||||
}
|
||||
u32 hash = scope->elements.slots[i].hash;
|
||||
auto interned = scope->elements.keys[i];
|
||||
|
||||
Entity *found = scope_insert_with_name(ctx->scope, interned, hash, decl);
|
||||
if (found != nullptr) {
|
||||
|
||||
@@ -1042,10 +1042,12 @@ gb_internal OdinDocArray<OdinDocScopeEntry> odin_doc_add_pkg_entries(OdinDocWrit
|
||||
auto entries = array_make<OdinDocScopeEntry>(heap_allocator(), 0, w->entity_cache.count);
|
||||
defer (array_free(&entries));
|
||||
|
||||
for (auto const &element : pkg->scope->elements) {
|
||||
u32 hash = element.hash;
|
||||
auto interned = pkg->scope->elements.keys[hash & (pkg->scope->elements.cap-1)];
|
||||
Entity *e = element.value;
|
||||
for (isize i = 0; i < pkg->scope->elements.cap; i++) {
|
||||
if (!pkg->scope->elements.slots[i].hash) {
|
||||
continue;
|
||||
}
|
||||
auto interned = pkg->scope->elements.keys[i];
|
||||
Entity *e = pkg->scope->elements.slots[i].value;
|
||||
switch (e->kind) {
|
||||
case Entity_Invalid:
|
||||
case Entity_Nil:
|
||||
|
||||
Reference in New Issue
Block a user