summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-03-19 22:59:17 -0700
committerOri Bernstein <ori@eigenstate.org>2015-03-19 23:13:58 -0700
commit7a946573a2c3edc352c95a356373d1e1174c490f (patch)
tree5e7b0e8f1bf6c7f236c19d6934e402e7968b858e /parse
parentdabf0985dfd46af098f4c2d3c5b817e9963b7498 (diff)
downloadmc-7a946573a2c3edc352c95a356373d1e1174c490f.tar.gz
Generate type descriptions for various types.
On our way to sane printf()!
Diffstat (limited to 'parse')
-rw-r--r--parse/gram.y1
-rw-r--r--parse/infer.c7
-rw-r--r--parse/parse.h3
-rw-r--r--parse/specialize.c1
4 files changed, 6 insertions, 6 deletions
diff --git a/parse/gram.y b/parse/gram.y
index 6a4ca0c..8190e9c 100644
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -406,7 +406,6 @@ tydef : Ttype typeid {$$ = $2;}
$$ = $2;
if ($$.nparams == 0) {
$$.type = mktyname($2.loc, mkname($2.loc, $2.name), $4);
- lappend(&file->file.tydefs, &file->file.ntydefs, $$.type);
} else {
$$.type = mktygeneric($2.loc, mkname($2.loc, $2.name), $2.params, $2.nparams, $4);
}
diff --git a/parse/infer.c b/parse/infer.c
index f866a8c..1163a1d 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -2010,6 +2010,7 @@ static void taghidden(Type *t)
taghidden(t->udecls[i]->etype);
break;
case Tyname:
+ t->isreflect = 1;
for (i = 0; i < t->narg; i++)
taghidden(t->arg[i]);
case Tygeneric:
@@ -2167,12 +2168,14 @@ void tagexports(Stab *st, int hidelocal)
taghidden(t);
for (j = 0; j < t->nsub; j++)
taghidden(t->sub[j]);
- if (t->type == Tyname)
+ if (t->type == Tyname) {
+ t->isreflect = 1;
for (j = 0; j < t->narg; j++)
taghidden(t->arg[j]);
- if (t->type == Tygeneric)
+ } else if (t->type == Tygeneric) {
for (j = 0; j < t->ngparam; j++)
taghidden(t->gparam[j]);
+ }
}
free(k);
diff --git a/parse/parse.h b/parse/parse.h
index 7225803..08d9057 100644
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -171,6 +171,7 @@ struct Type {
char ishidden; /* Tyname: whether this is hidden or not */
char ispkglocal; /* Tyname: whether this is package local or not */
char isimport; /* Tyname: whether tyis type was imported. */
+ char isreflect; /* Tyname: whether this type has reflection info */
};
struct Ucon {
@@ -213,8 +214,6 @@ struct Node {
Node **stmts;
size_t nstmts;
Stab *globls;
- size_t ntydefs;
- Type **tydefs;
} file;
struct {
diff --git a/parse/specialize.c b/parse/specialize.c
index d869c2c..4cb38a0 100644
--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -52,7 +52,6 @@ Type *tyspecialize(Type *t, Htab *tsmap, Htab *delayed)
htput(tsmap, t, ret);
for (i = 0; i < t->ngparam; i++)
lappend(&ret->arg, &ret->narg, tyspecialize(t->gparam[i], tsmap, delayed));
- lappend(&file->file.tydefs, &file->file.ntydefs, ret);
break;
case Tyname:
arg = NULL;