summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-08-19 18:30:29 -0700
committerOri Bernstein <ori@eigenstate.org>2017-08-19 18:52:14 -0700
commitdfed30d87b4f9dbae24b16ddd32ea0be69a5d602 (patch)
treea9e5d3932c6ab18e190e915de78d0792a62b9b7b /parse
parentbd96cb6a0a361a62871f70c07fc350bc2264b087 (diff)
downloadmc-dfed30d87b4f9dbae24b16ddd32ea0be69a5d602.tar.gz
File is already global.
Let's use it.
Diffstat (limited to 'parse')
-rw-r--r--parse/infer.c33
-rw-r--r--parse/parse.h2
2 files changed, 17 insertions, 18 deletions
diff --git a/parse/infer.c b/parse/infer.c
index e29dd80..29b3006 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1134,13 +1134,13 @@ unifyparams(Node *ctx, Type *a, Type *b)
}
static void
-loaduses(Node *n)
+loaduses(void)
{
size_t i;
/* uses only allowed at top level. Do we want to keep it this way? */
- for (i = 0; i < n->file.nuses; i++)
- readuse(n->file.uses[i], n->file.globls, Visintern);
+ for (i = 0; i < file->file.nuses; i++)
+ readuse(file->file.uses[i], file->file.globls, Visintern);
}
static Type *
@@ -2510,7 +2510,7 @@ itertype(Node *n, Type *ret)
* with the type parameters replaced with the
* specialized types */
static void
-specialize(Node *f)
+specialize(void)
{
Node *d, *n, *name;
Type *ty, *it, *dt;
@@ -2562,7 +2562,7 @@ specialize(Node *f)
}
static void
-applytraits(Node *f)
+applytraits(void)
{
size_t i;
Node *impl, *n;
@@ -2571,7 +2571,7 @@ applytraits(Node *f)
Stab *ns;
tr = NULL;
- pushstab(f->file.globls);
+ pushstab(file->file.globls);
/* for now, traits can only be declared globally */
for (i = 0; i < nimpltab; i++) {
impl = impltab[i];
@@ -2602,17 +2602,17 @@ applytraits(Node *f)
}
void
-verify(Node *f)
+verify(void)
{
Type *t;
Node *n;
size_t i;
- pushstab(f->file.globls);
+ pushstab(file->file.globls);
/* for now, traits can only be declared globally */
- for (i = 0; i < f->file.nstmts; i++) {
- if (f->file.stmts[i]->type == Nimpl) {
- n = f->file.stmts[i];
+ for (i = 0; i < file->file.nstmts; i++) {
+ n = file->file.stmts[i];
+ if (n->type == Nimpl) {
/* we merge, so we need to get it back again when error checking */
if (n->impl.isproto)
fatal(n, "missing implementation for prototype '%s %s'",
@@ -2630,21 +2630,20 @@ verify(Node *f)
}
void
-infer(Node *file)
+infer()
{
- assert(file->type == Nfile);
delayed = mkht(tyhash, tyeq);
seqbase = mkht(tyhash, tyeq);
/* set up the symtabs */
- loaduses(file);
+ loaduses();
/* do the inference */
- applytraits(file);
+ applytraits();
infernode(&file, NULL, NULL);
postinfer();
/* and replace type vars with actual types */
typesub(file, 0);
- specialize(file);
- verify(file);
+ specialize();
+ verify();
}
diff --git a/parse/parse.h b/parse/parse.h
index 1fc3ac9..b142c33 100644
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -550,7 +550,7 @@ void addextlibs(Node *file, char **libs, size_t nlibs);
Node *fold(Node *n, int foldvar);
/* typechecking/inference */
-void infer(Node *file);
+void infer(void);
Type *tysearch(Type *t);
/* debug */