parse.y: check duplicated argument names; fix #5575

parent f69eafc6
...@@ -299,6 +299,14 @@ static void ...@@ -299,6 +299,14 @@ static void
local_add_f(parser_state *p, mrb_sym sym) local_add_f(parser_state *p, mrb_sym sym)
{ {
if (p->locals) { if (p->locals) {
node *n = p->locals->car;
while (n) {
if (sym(n->car) == sym) {
yyerror(p, "duplicated argument name");
return;
}
n = n->cdr;
}
p->locals->car = push(p->locals->car, nsym(sym)); p->locals->car = push(p->locals->car, nsym(sym));
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment