summaryrefslogtreecommitdiff
path: root/parse/use.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2017-06-28 03:24:57 -0700
committerOri Bernstein <ori@markovcorp.com>2017-06-28 10:59:54 -0700
commit567766b0cb773c76a9ec0d16246bd27b4a46b851 (patch)
tree47da5cff2284f691083c6b8445ded0047a174e85 /parse/use.c
parent6f5af8562ed5547ddaeb15ba7ed4a334318ca53f (diff)
downloadmc-567766b0cb773c76a9ec0d16246bd27b4a46b851.tar.gz
Remove unused memb from Trait and rename funcs -> proto
These are prototype declarations that must be implemented by the impl (not necessarily functions), so proto seems like a better name.
Diffstat (limited to 'parse/use.c')
-rw-r--r--parse/use.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/parse/use.c b/parse/use.c
index c551738..1c02a6b 100644
--- a/parse/use.c
+++ b/parse/use.c
@@ -288,12 +288,9 @@ static void traitpickle(FILE *fd, Trait *tr)
wrint(fd, tr->naux);
for (i = 0; i < tr->naux; i++)
wrtype(fd, tr->aux[i]);
- wrint(fd, tr->nmemb);
- for (i = 0; i < tr->nmemb; i++)
- wrsym(fd, tr->memb[i]);
- wrint(fd, tr->nfuncs);
- for (i = 0; i < tr->nfuncs; i++)
- wrsym(fd, tr->funcs[i]);
+ wrint(fd, tr->nproto);
+ for (i = 0; i < tr->nproto; i++)
+ wrsym(fd, tr->proto[i]);
}
static void wrtype(FILE *fd, Type *ty)
@@ -407,7 +404,7 @@ static Type *tyunpickle(FILE *fd)
Trait *traitunpickle(FILE *fd)
{
Trait *tr;
- Node *fn;
+ Node *proto;
size_t i, n;
intptr_t uid;
@@ -415,7 +412,6 @@ Trait *traitunpickle(FILE *fd)
tr = mktrait(Zloc, NULL, NULL,
NULL, 0,
NULL, 0,
- NULL, 0,
0);
uid = rdint(fd);
if (rdint(fd) == Vishidden)
@@ -428,13 +424,10 @@ Trait *traitunpickle(FILE *fd)
for (i = 0; i < tr->naux; i++)
rdtype(fd, &tr->aux[i]);
n = rdint(fd);
- for (i = 0; i < n; i++)
- lappend(&tr->memb, &tr->nmemb, rdsym(fd, tr));
- n = rdint(fd);
for (i = 0; i < n; i++) {
- fn = rdsym(fd, tr);
- fn->decl.impls = mkht(tyhash, tyeq);
- lappend(&tr->funcs, &tr->nfuncs, fn);
+ proto = rdsym(fd, tr);
+ proto->decl.impls = mkht(tyhash, tyeq);
+ lappend(&tr->proto, &tr->nproto, proto);
}
htput(trmap, itop(uid), tr);
return tr;
@@ -837,8 +830,8 @@ static void protomap(Trait *tr, Type *ty, Node *dcl)
Node *proto;
dclname = declname(dcl);
- for (i = 0; i < tr->nfuncs; i++) {
- proto = tr->funcs[i];
+ for (i = 0; i < tr->nproto; i++) {
+ proto = tr->proto[i];
protoname = declname(proto);
len = strlen(protoname);
p = strstr(dclname, protoname);
@@ -979,8 +972,8 @@ foundextlib:
if (!tr->ishidden) {
tr->vis = vis;
puttrait(s, tr->name, tr);
- for (i = 0; i < tr->nfuncs; i++) {
- putdcl(s, tr->funcs[i]);
+ for (i = 0; i < tr->nproto; i++) {
+ putdcl(s, tr->proto[i]);
}
}
break;