w6c: preserve grouped and qualified types in wwi

This commit is contained in:
2026-08-09 03:31:40 +09:00
parent 53a9e94736
commit 0a16811ab1
3 changed files with 87 additions and 18 deletions

View File

@@ -45,11 +45,20 @@ static Sym *
wwi_typesym(Checker *c, const char *nm)
{
if (nm == NULL) return NULL;
Sym *s = scope_lookup_type(c->cur, NULL, nm);
if (s == NULL) {
const char *dot = strrchr(nm, '.');
if (dot)
s = scope_lookup_type(c->cur, NULL, dot + 1);
const char *dot = strrchr(nm, '.');
Sym *s = NULL;
if (dot) {
size_t n = (size_t)(dot - nm);
for (Node *u = c->file->list; u; u = u->next) {
if (u->kind != N_USE || !wwi_primary(u) || u->str == NULL
|| strlen(u->str) != n || strncmp(u->str, nm, n) != 0)
continue;
const char *mod = u->usepath ? u->usepath : u->str;
s = scope_lookup_in_module(c->cur, mod, dot + 1);
break;
}
} else {
s = scope_lookup_type(c->cur, NULL, nm);
}
if (s && s->kind == SK_TYPE)
return s;
@@ -338,9 +347,11 @@ wwi_expr(FILE *of, Node *e)
* as the plain int 1114111). */
case N_RUNELIT: wwi_rune(of, e->uval); break;
case N_BIN:
fputc('(', of);
wwi_expr(of, e->lhs);
fprintf(of, " %s ", tokname(e->op));
wwi_expr(of, e->rhs);
fputc(')', of);
break;
case N_UN:
fputs(tokname(e->op), of);