aboutsummaryrefslogtreecommitdiff
path: root/src/name_canonicalization.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2025-02-24 15:44:38 +0000
committergingerBill <bill@gingerbill.org>2025-02-24 15:44:38 +0000
commit344eb6cb42a635f36d669fee8fc25dc37c852ba1 (patch)
tree6b51a8733cd29385d49620dba9bd21d42b1a7e5f /src/name_canonicalization.cpp
parentf56a0a80d3b606b1cbefb973b03b9ddae88bbf48 (diff)
Fix name canonicalization for doc writer
Diffstat (limited to 'src/name_canonicalization.cpp')
-rw-r--r--src/name_canonicalization.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/name_canonicalization.cpp b/src/name_canonicalization.cpp
index 5d311068f..a80dc1996 100644
--- a/src/name_canonicalization.cpp
+++ b/src/name_canonicalization.cpp
@@ -520,6 +520,8 @@ write_base_name:
return;
}
+gb_internal bool is_in_doc_writer(void);
+
// NOTE(bill): This exists so that we deterministically hash a type by serializing it to a canonical string
gb_internal void write_type_to_canonical_string(TypeWriter *w, Type *type) {
if (type == nullptr) {
@@ -719,7 +721,13 @@ gb_internal void write_type_to_canonical_string(TypeWriter *w, Type *type) {
return;
case Type_Generic:
- GB_PANIC("Type_Generic should never be hit");
+ if (is_in_doc_writer()) {
+ type_writer_appendc(w, "$");
+ type_writer_append(w, type->Generic.name.text, type->Generic.name.len);
+ type_writer_append_fmt(w, "%lld", cast(long long)type->Generic.id);
+ } else {
+ GB_PANIC("Type_Generic should never be hit");
+ }
return;
case Type_Named: