summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-10-07 18:31:44 -0400
committerOri Bernstein <ori@eigenstate.org>2014-10-07 18:31:44 -0400
commit762e7638bf6344ef81bdf95b5b9687542ed23f72 (patch)
treeeb1457488265b996717707049372bbb4249c6d3a
parenta9735e1242911e9c51f8d7b0de75772ef7b5cfb6 (diff)
downloadmc-762e7638bf6344ef81bdf95b5b9687542ed23f72.tar.gz
Write out all important attrs on decls in usefiles.
-rw-r--r--libstd/alloc.myr1
-rw-r--r--parse/infer.c18
-rw-r--r--parse/use.c16
3 files changed, 28 insertions, 7 deletions
diff --git a/libstd/alloc.myr b/libstd/alloc.myr
index a18a24d..cddebe6 100644
--- a/libstd/alloc.myr
+++ b/libstd/alloc.myr
@@ -391,6 +391,7 @@ const allocsz = {sz
else
-> align(sz, Pagesz)
;;
+ die("Size does not match any buckets")
}
/*
diff --git a/parse/infer.c b/parse/infer.c
index 6e2dadf..58a283c 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -861,6 +861,21 @@ static void fiximpls(Inferstate *st, Stab *s)
free(k);
}
+static void mergeattrs(Node *a, Node *b)
+{
+ if (!a || !b)
+ return;
+
+ a->decl.isglobl = a->decl.isglobl || b->decl.isglobl;
+ a->decl.isconst = a->decl.isconst || b->decl.isconst;
+ a->decl.isextern = a->decl.isextern || b->decl.isextern;
+ a->decl.ispkglocal = a->decl.ispkglocal || b->decl.ispkglocal;
+ a->decl.ishidden = a->decl.ishidden || b->decl.ishidden;
+ a->decl.isimport = a->decl.isimport || b->decl.isimport;
+ a->decl.isnoret = a->decl.isnoret || b->decl.isnoret;
+ a->decl.isexportinit = a->decl.isexportinit || b->decl.isexportinit;
+}
+
/* The exports in package declarations
* need to be merged with the declarations
* at the global scope. Declarations in
@@ -970,7 +985,8 @@ static void mergeexports(Inferstate *st, Node *file)
fatal(nx->line, "Export %s double-defined on line %d", ctxstr(st, nx), ng->line);
if (nx->decl.isgeneric != ng->decl.isgeneric)
fatal(nx->line, "Export %s defined with different genericness on line %d", ctxstr(st, nx), ng->line);
- ng->decl.ispkglocal = nx->decl.ispkglocal;
+ mergeattrs(ng, nx);
+ mergeattrs(nx, ng);
unify(st, nx, type(st, ng), type(st, nx));
} else {
if (!nx->decl.isextern && !nx->decl.isimport && !nx->decl.trait)
diff --git a/parse/use.c b/parse/use.c
index b82ae52..d4bab47 100644
--- a/parse/use.c
+++ b/parse/use.c
@@ -493,9 +493,11 @@ static void pickle(FILE *fd, Node *n)
wrtype(fd, n->decl.type);
/* symflags */
- wrint(fd, n->decl.isconst);
- wrint(fd, n->decl.isgeneric);
- wrint(fd, n->decl.isextern);
+ wrbool(fd, n->decl.isconst);
+ wrbool(fd, n->decl.isgeneric);
+ wrbool(fd, n->decl.isextern);
+ wrbool(fd, n->decl.isnoret);
+ wrbool(fd, n->decl.ispkglocal);
/* init */
pickle(fd, n->decl.init);
@@ -628,9 +630,11 @@ static Node *unpickle(FILE *fd)
rdtype(fd, &n->decl.type);
/* symflags */
- n->decl.isconst = rdint(fd);
- n->decl.isgeneric = rdint(fd);
- n->decl.isextern = rdint(fd);
+ n->decl.isconst = rdbool(fd);
+ n->decl.isgeneric = rdbool(fd);
+ n->decl.isextern = rdbool(fd);
+ n->decl.isnoret = rdbool(fd);
+ n->decl.ispkglocal = rdbool(fd);
/* init */
n->decl.init = unpickle(fd);