summaryrefslogtreecommitdiff
path: root/parse/gram.y
diff options
context:
space:
mode:
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);
}