ref: 434ae67268c108d372392c0c45dd7b50ea33ba4d
parent: 4586e818327b3042e7caec7469e9482d1b50b265
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Mar 10 12:42:00 EST 2022
Issue #156: Fix check for duplicate formal parameters when strict. Duplicate var and function declarations are still allowed.
--- a/jscompile.c
+++ b/jscompile.c
@@ -1366,7 +1366,7 @@
emitfunction(J, F, newfun(J, stm->line, stm->a, stm->b, stm->c, 0, F->strict));
emitline(J, F, stm);
emit(J, F, OP_SETLOCAL);
- emitarg(J, F, addlocal(J, F, stm->a, 0));
+ emitarg(J, F, addlocal(J, F, stm->a, 1));
emit(J, F, OP_POP);
}
list = list->b;
@@ -1400,7 +1400,7 @@
if (findlocal(J, F, name->string) < 0) {
emit(J, F, OP_CURRENT);
emit(J, F, OP_SETLOCAL);
- emitarg(J, F, addlocal(J, F, name, 0));
+ emitarg(J, F, addlocal(J, F, name, 1));
emit(J, F, OP_POP);
}
}