aboutsummaryrefslogtreecommitdiff
path: root/src/name_canonicalization.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2025-02-18 15:26:59 +0000
committergingerBill <bill@gingerbill.org>2025-02-18 15:26:59 +0000
commit0482facdda4fd9257202fb89d9563d5a44e1499a (patch)
treeefebd5f2ac30f3dca9c3fdab1ab5d39e9cfd1c42 /src/name_canonicalization.cpp
parente168cea67011f43209d752d52bad862a6416795e (diff)
Fix for weird builtin types
Diffstat (limited to 'src/name_canonicalization.cpp')
-rw-r--r--src/name_canonicalization.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/name_canonicalization.cpp b/src/name_canonicalization.cpp
index 0e81ab12c..6f092181c 100644
--- a/src/name_canonicalization.cpp
+++ b/src/name_canonicalization.cpp
@@ -448,11 +448,15 @@ gb_internal void write_canonical_entity_name(TypeWriter *w, Entity *e) {
return;
}
- if ((e->scope->flags & (ScopeFlag_File | ScopeFlag_Pkg)) == 0 ||
- e->flags & EntityFlag_NotExported) {
-
+ if (e->scope->flags & (ScopeFlag_Builtin)) {
+ // ignore
+ } else if ((e->scope->flags & (ScopeFlag_File | ScopeFlag_Pkg)) == 0) {
Scope *s = e->scope;
+
while ((s->flags & (ScopeFlag_Proc|ScopeFlag_File)) == 0 && s->decl_info == nullptr) {
+ if (s->parent == nullptr) {
+ break;
+ }
s = s->parent;
}
@@ -470,6 +474,8 @@ gb_internal void write_canonical_entity_name(TypeWriter *w, Entity *e) {
}
type_writer_appendc(w, gb_bprintf(CANONICAL_NAME_SEPARATOR "[%.*s]" CANONICAL_NAME_SEPARATOR, LIT(file_name)));
goto write_base_name;
+ } else if (s->flags & (ScopeFlag_Builtin)) {
+ goto write_base_name;
}
gb_printf_err("%s WEIRD ENTITY TYPE %s %u %p\n", token_pos_to_string(e->token.pos), type_to_string(e->type), s->flags, s->decl_info);
@@ -487,7 +493,7 @@ gb_internal void write_canonical_entity_name(TypeWriter *w, Entity *e) {
};
print_scope_flags(s);
- GB_PANIC("weird entity");
+ GB_PANIC("weird entity %.*s", LIT(e->token.string));
}
if (e->pkg != nullptr) {
type_writer_append(w, e->pkg->name.text, e->pkg->name.len);