parse.y: allow arguments start with `_` to appear multiple times; fix #5604

parent 3b59c95e
...@@ -302,9 +302,13 @@ local_add_f(parser_state *p, mrb_sym sym) ...@@ -302,9 +302,13 @@ local_add_f(parser_state *p, mrb_sym sym)
node *n = p->locals->car; node *n = p->locals->car;
while (n) { while (n) {
if (sym(n->car) == sym) { if (sym(n->car) == sym) {
mrb_int len;
const char* name = mrb_sym_name_len(p->mrb, sym, &len);
if (len > 0 && name[0] != '_') {
yyerror(p, "duplicated argument name"); yyerror(p, "duplicated argument name");
return; return;
} }
}
n = n->cdr; 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