parse.y: numbered parameters should not appear on toplevel.
Toplevel includes the top of the method/class/module definitions.
@@ -6422,6 +6422,7 @@ parser_yylex(parser_state *p)
nvars = nvars->cdr;
}
nvar = intn(p->nvars->car);
+ if (nvar != -2) { /* numbered parameters never appear on toplevel */
if (nvar == -1) {
yywarning(p, "numbered parameter used in inner block");
}
@@ -6433,6 +6434,7 @@ parser_yylex(parser_state *p)
return tNUMPARAM;
}
}
+ }
/* fall through */
default:
if (toklast(p) == '!' || toklast(p) == '?') {
