shithub: mc

Download patch

ref: 0777dce112452cb95d09037ef49a5f35b48ed6e3
parent: 1ef5877bce5a4fcbe6e68b00f1ba087384d6343c
author: Ori Bernstein <[email protected]>
date: Fri Aug 23 17:14:45 EDT 2013

Split out type lookup and resolution from the same function.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -263,9 +263,8 @@
         fatal(t->line, "Type %s includes itself", tystr(t));
 }
 
-/* fixd the most accurate type mapping we have (ie,
- * the end of the unification chain */
-static Type *tf(Inferstate *st, Type *t)
+/* Look up the best type to date in the unification table, returning it */
+static Type *tysearch(Inferstate *st, Type *t)
 {
     Type *lu;
     Stab *ns;
@@ -289,6 +288,14 @@
             break;
         t = tytab[t->tid];
     }
+    return t;
+}
+
+/* fixd the most accurate type mapping we have (ie,
+ * the end of the unification chain */
+static Type *tf(Inferstate *st, Type *t)
+{
+    t = tysearch(st, t);
     st->ingeneric += t->isgeneric;
     tyresolve(st, t);
     st->ingeneric -= t->isgeneric;