summaryrefslogtreecommitdiff
path: root/parse/gram.y
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2019-03-04 00:17:19 -0800
committerOri Bernstein <ori@eigenstate.org>2019-03-14 00:20:54 -0700
commit01cf9608db97e2b4fe6bec921ab1c28201605f82 (patch)
treeb5a73222282fac3210f36020fae4aaff92ed93b3 /parse/gram.y
parent1c20d382566fcdfdf5585b1bd8f1f27d7dbd6425 (diff)
downloadmc-01cf9608db97e2b4fe6bec921ab1c28201605f82.tar.gz
Get a bit better at wrangling type bindings.
Diffstat (limited to 'parse/gram.y')
-rw-r--r--parse/gram.y7
1 files changed, 4 insertions, 3 deletions
diff --git a/parse/gram.y b/parse/gram.y
index 77d9f44..a5151fd 100644
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -1250,10 +1250,11 @@ mergeenv(Node *dcl, Node *init)
if (init->type != Nexpr || exprop(init) != Olit)
return;
- if (init->lit.littype != Lfunc)
+ if (init->expr.args[0]->lit.littype != Lfunc)
return;
- f = init->lit.fnval;
- f->func.env = dcl->decl.env;
+ f = init->expr.args[0]->lit.fnval;
+ if (!dcl->decl.env)
+ dcl->decl.env = mkenv();
bindtype(dcl->decl.env, f->func.type);
}