ref: a2352649c2a8f5937335a8c791f3581f52cd8d6f
parent: 7f8734b0b4c43f60a3b4a79929fe60725f64fbc2
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Oct 8 17:44:52 EDT 2016
Don't infer things multiple times. In addition to installing variables repeatedly, it's just kind of inefficient.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1068,7 +1068,6 @@
if (ft->sub[i]->type == Tyvalist) {
break;
}
- inferexpr(st, &n->expr.args[i], NULL, NULL);
unify(st, n->expr.args[0], ft->sub[i], type(st, n->expr.args[i]));
}
if (i < ft->nsub && ft->sub[i]->type != Tyvalist)
@@ -1803,6 +1802,9 @@
n = *np;
if (!n)
return;
+ if (n->inferred)
+ return;
+ n->inferred = 1;
switch (n->type) {
case Nfile:
pushstab(n->file.globls);
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -178,6 +178,7 @@
Srcloc loc;
Ntype type;
int nid;
+ char inferred;
union {
struct {
size_t nfiles; /* file names for location mapping */