mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user