diff options
| author | Andreas T Jonsson <mail@andreasjonsson.se> | 2024-05-13 09:21:32 +0200 |
|---|---|---|
| committer | Andreas T Jonsson <mail@andreasjonsson.se> | 2024-05-13 09:21:32 +0200 |
| commit | 5d82f0cad5e0500d577bb03e1c175716d4d8b995 (patch) | |
| tree | 86b4662246c85cfa2a58ee22d101cc8ffc14df54 /src/docs_writer.cpp | |
| parent | f428e30211c3113ac7c7918f9a0f5c03cc7b4669 (diff) | |
| parent | 1183f4794b5bd3f1afddbb351c941a8a617a085f (diff) | |
Merge branch 'master' into netbsd
Diffstat (limited to 'src/docs_writer.cpp')
| -rw-r--r-- | src/docs_writer.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/docs_writer.cpp b/src/docs_writer.cpp index ba71eae4d..ad8d9d245 100644 --- a/src/docs_writer.cpp +++ b/src/docs_writer.cpp @@ -26,11 +26,11 @@ struct OdinDocWriter { StringMap<OdinDocString> string_cache; - PtrMap<AstFile *, OdinDocFileIndex> file_cache; - PtrMap<AstPackage *, OdinDocPkgIndex> pkg_cache; - PtrMap<Entity *, OdinDocEntityIndex> entity_cache; - PtrMap<Type *, OdinDocTypeIndex> type_cache; - PtrMap<Type *, Type *> stable_type_cache; + OrderedInsertPtrMap<AstFile *, OdinDocFileIndex> file_cache; + OrderedInsertPtrMap<AstPackage *, OdinDocPkgIndex> pkg_cache; + OrderedInsertPtrMap<Entity *, OdinDocEntityIndex> entity_cache; + OrderedInsertPtrMap<Type *, OdinDocTypeIndex> type_cache; + OrderedInsertPtrMap<Type *, Type *> stable_type_cache; OdinDocWriterItemTracker<OdinDocFile> files; OdinDocWriterItemTracker<OdinDocPkg> pkgs; @@ -57,11 +57,11 @@ gb_internal void odin_doc_writer_prepare(OdinDocWriter *w) { string_map_init(&w->string_cache); - map_init(&w->file_cache); - map_init(&w->pkg_cache); - map_init(&w->entity_cache); - map_init(&w->type_cache); - map_init(&w->stable_type_cache); + map_init(&w->file_cache, 1<<10); + map_init(&w->pkg_cache, 1<<10); + map_init(&w->entity_cache, 1<<18); + map_init(&w->type_cache, 1<<18); + map_init(&w->stable_type_cache, 1<<18); odin_doc_writer_item_tracker_init(&w->files, 1); odin_doc_writer_item_tracker_init(&w->pkgs, 1); @@ -485,6 +485,13 @@ gb_internal OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type) { return 0; } + if (type->kind == Type_Named) { + Entity *e = type->Named.type_name; + if (e->TypeName.is_type_alias) { + type = type->Named.base; + } + } + // Type **mapped_type = map_get(&w->stable_type_cache, type); // may map to itself // if (mapped_type && *mapped_type) { // type = *mapped_type; @@ -506,13 +513,6 @@ gb_internal OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type) { if (!x | !y) { continue; } - - if (x->kind == Type_Named) { - Entity *e = x->Named.type_name; - if (e->TypeName.is_type_alias) { - x = x->Named.base; - } - } if (y->kind == Type_Named) { Entity *e = y->Named.type_name; if (e->TypeName.is_type_alias) { |