summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-05-08 01:06:17 -0700
committerOri Bernstein <ori@eigenstate.org>2015-05-08 01:06:17 -0700
commit1f6f2f9b343ba8eb859258af7f1939d542bfa713 (patch)
treeac3dbb71a50d046af575f2cda53f68a4acadb248 /parse
parent3623ee59e2c80fe5a5334f3e52499295b510f026 (diff)
downloadmc-1f6f2f9b343ba8eb859258af7f1939d542bfa713.tar.gz
Get closer to a working use-before-def check.
Diffstat (limited to 'parse')
-rw-r--r--parse/node.c6
-rw-r--r--parse/parse.h3
2 files changed, 6 insertions, 3 deletions
diff --git a/parse/node.c b/parse/node.c
index 4bca3a6..ba3cd3c 100644
--- a/parse/node.c
+++ b/parse/node.c
@@ -12,7 +12,8 @@
#include "parse.h"
-size_t maxnid;
+Node **nodes;
+size_t nnodes;
Node **decls;
size_t ndecls;
@@ -49,9 +50,10 @@ Node *mknode(Srcloc loc, Ntype nt)
Node *n;
n = zalloc(sizeof(Node));
- n->nid = maxnid++;
+ n->nid = nnodes;
n->type = nt;
n->loc = loc;
+ lappend(&nodes, &nnodes, n);
return n;
}
diff --git a/parse/parse.h b/parse/parse.h
index 1cc9323..fa7b99e 100644
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -375,10 +375,11 @@ extern size_t ntypes;
extern Trait **traittab; /* int -> trait map */
extern size_t ntraittab;
extern Node **decls; /* decl id -> decl map */
+extern size_t nnodes;
+extern Node **nodes; /* node id -> node map */
extern size_t ndecls;
extern Node **exportimpls;
extern size_t nexportimpls;
-extern size_t maxnid; /* the maximum node id generated so far */
/* property tables */
extern int opispure[];