Prohibit numbered parameters as method arguments; fix #4892

As of CRuby2.7 it is only warned. `mruby` prohibits explicitly to
implement the future Ruby3 behavior.
parent 716102ff
......@@ -3538,6 +3538,11 @@ f_bad_arg : tCONSTANT
yyerror(p, "formal argument cannot be a class variable");
$$ = 0;
}
| tNUMPARAM
{
yyerror(p, "formal argument cannot be a numbered parameter");
$$ = 0;
}
;
f_norm_arg : f_bad_arg
......@@ -5969,9 +5974,6 @@ parser_yylex(parser_state *p)
nvars->cdr = nint(-1);
nvars = nvars->car;
}
if (intn(p->nvars->cdr) < 0) {
yywarning(p, "numbered parameter in nested block");
}
pylval.num = n;
p->lstate = EXPR_END;
return tNUMPARAM;
......
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