Replace compiler for loops for the hash-table types to simplify code usage

This commit is contained in:
gingerBill
2022-12-09 11:29:28 +00:00
parent ffe953b43d
commit 34a048f7da
18 changed files with 269 additions and 209 deletions

View File

@@ -222,8 +222,8 @@ void print_doc_package(CheckerInfo *info, AstPackage *pkg) {
if (pkg->scope != nullptr) {
auto entities = array_make<Entity *>(heap_allocator(), 0, pkg->scope->elements.entries.count);
defer (array_free(&entities));
for_array(i, pkg->scope->elements.entries) {
Entity *e = pkg->scope->elements.entries[i].value;
for (auto const &entry : pkg->scope->elements) {
Entity *e = entry.value;
switch (e->kind) {
case Entity_Invalid:
case Entity_Builtin:
@@ -359,8 +359,8 @@ void generate_documentation(Checker *c) {
odin_doc_write(info, output_file_path);
} else {
auto pkgs = array_make<AstPackage *>(permanent_allocator(), 0, info->packages.entries.count);
for_array(i, info->packages.entries) {
AstPackage *pkg = info->packages.entries[i].value;
for (auto const &entry : info->packages) {
AstPackage *pkg = entry.value;
if (build_context.cmd_doc_flags & CmdDocFlag_AllPackages) {
array_add(&pkgs, pkg);
} else {