ww: implement package initialization

This commit is contained in:
2026-08-14 19:02:35 +09:00
parent 72e890d5aa
commit c6bec0914d
24 changed files with 5279 additions and 1009 deletions

View File

@@ -1326,9 +1326,7 @@ parseuse(Parser *p)
const char *alias = NULL;
const char *first;
if (p->cur.kind == TK_UNDER) {
errorf(p->cur.pos, "blank import alias _ is not implemented");
p->errs++;
alias = "_";
n->useblank = 1;
advance(p);
first = expectident(p);
} else {
@@ -1344,8 +1342,10 @@ parseuse(Parser *p)
leaf = expectident(p);
path = aprintf(p->a, "%s.%s", path, leaf);
}
n->str = alias ? alias : leaf;
n->strlen = strlen(n->str);
if (!n->useblank) {
n->str = alias ? alias : leaf;
n->strlen = strlen(n->str);
}
n->usesource = path;
n->usepath = path;
n->usealias = alias;