w6c: preserve grouped and qualified types in wwi
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user