summaryrefslogtreecommitdiff
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
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.
-rw-r--r--lib/regex/interp.myr4
-rw-r--r--parse/node.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/regex/interp.myr b/lib/regex/interp.myr
index abb907c..6c2c68b 100644
--- a/lib/regex/interp.myr
+++ b/lib/regex/interp.myr
@@ -387,7 +387,7 @@ const step = {re, thr, curip
mstart = std.sldup(thr.mstart)
mend = std.sldup(thr.mend)
hit(re, thr)
- fork(re, thr, rip, curip, mstart, mend)
+ fork(re, rip, curip, mstart, mend)
if re.debug
std.slpush(&re.traces, std.bsdup(re.traces[thr.tid]))
;;
@@ -407,7 +407,7 @@ const step = {re, thr, curip
-> true
}
-const fork = {re, thr, ip, curip, mstart, mend
+const fork = {re, ip, curip, mstart, mend
var thr
if ip == curip /* loop detection */
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;