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.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-12-21 23:03:08 +09:00
parent 716102fff3
commit 7e6355975e
+5 -3
View File
@@ -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;