Fix name canonicalization for doc writer

This commit is contained in:
gingerBill
2025-02-24 15:44:38 +00:00
parent f56a0a80d3
commit 344eb6cb42
2 changed files with 20 additions and 1 deletions

View File

@@ -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: