ref: 89c49739f36b4e8fa6f1eaa0e506e1f67900e8e5
parent: a61cdcb7496036b21256a5008465ad03583bc8d4
author: Ori Bernstein <[email protected]>
date: Mon Sep 10 07:08:50 EDT 2012
Bind type parameters in names.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -342,6 +342,8 @@
return;
htput(bt, t->pname, t);
+ for (i = 0; i < t->nparam; i++)
+ tybind(st, bt, t->param[i]);
for (i = 0; i < t->nsub; i++)
tybind(st, bt, t->sub[i]);
}
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -105,8 +105,8 @@
Node **cstrlist; /* The names of the constraints on the type. Used to fill the bitset */
size_t ncstrlist; /* The length of the constraint list above */
- Type **params; /* Tyname: the type parameters captured */
- size_t nparams; /* Tyname: the number of type parameters */
+ Type **param; /* Tyname: the type parameters captured */
+ size_t nparam; /* Tyname: the number of type parameters */
Type **sub; /* sub-types; shared by all composite types */
size_t nsub; /* For compound types */
--- a/parse/type.c
+++ b/parse/type.c
@@ -128,7 +128,7 @@
return t;
}
-Type *mktytmpl(int line, Node *name, Type **params, size_t nparams, Type *base)
+Type *mktytmpl(int line, Node *name, Type **param, size_t nparam, Type *base)
{
Type *t;
@@ -138,8 +138,8 @@
t->cstrs = bsdup(base->cstrs);
t->sub = xalloc(sizeof(Type*));
t->sub[0] = base;
- t->params = params;
- t->nparams = nparams;
+ t->param = param;
+ t->nparam = nparam;
return t;
}
@@ -439,11 +439,11 @@
break;
case Tyname:
p += snprintf(p, end - p, "%s", namestr(t->name));
- if (t->nparams) {
+ if (t->nparam) {
p += snprintf(p, end - p, "(");
- for (i = 0; i < t->nparams; i++) {
+ for (i = 0; i < t->nparam; i++) {
p += snprintf(p, end - p, "%s", sep);
- p += tybfmt(p, end - p, t->params[i]);
+ p += tybfmt(p, end - p, t->param[i]);
sep = ", ";
}
p += snprintf(p, end - p, ")");
@@ -456,7 +456,7 @@
break;
}
- /* we only show constraints on non-builtin typarams */
+ /* we only show constraints on non-builtin typaram */
if (t->type == Tyvar || t->type == Typaram)
p += cstrfmt(p, end - p, t);