summaryrefslogtreecommitdiff
path: root/parse/node.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-07-03 23:21:19 -0700
committerOri Bernstein <ori@eigenstate.org>2017-07-03 23:27:02 -0700
commit00e81c21f68c73403e42d08a6d5d955aa303cefd (patch)
tree4116752c87aae7e01ffda52d97181a0daa08cf07 /parse/node.c
parentb37fc330005640f45c9691fe256993cb0b4e3e6c (diff)
downloadmc-00e81c21f68c73403e42d08a6d5d955aa303cefd.tar.gz
Function args should go into the block stab.
Now we get errors if a function body shadows its args.
Diffstat (limited to 'parse/node.c')
-rw-r--r--parse/node.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/parse/node.c b/parse/node.c
index 936db36..6489c21 100644
--- a/parse/node.c
+++ b/parse/node.c
@@ -186,6 +186,7 @@ Node *mkfunc(Srcloc loc, Node **args, size_t nargs, Type *ret, Node *body)
Node *n;
Node *f;
size_t i;
+ Stab *st;
f = mknode(loc, Nfunc);
f->func.args = args;
@@ -194,8 +195,9 @@ Node *mkfunc(Srcloc loc, Node **args, size_t nargs, Type *ret, Node *body)
f->func.scope = mkstab(1);
f->func.type = mktyfunc(loc, args, nargs, ret);
+ st = body->block.scope;
for (i = 0; i < nargs; i++)
- putdcl(f->func.scope, args[i]);
+ putdcl(st, args[i]);
n = mknode(loc, Nlit);
n->lit.littype = Lfunc;