parse.y: numbered parameters should not appear on toplevel.

Toplevel includes the top of the method/class/module definitions.
parent 3a30cc27
...@@ -6422,15 +6422,17 @@ parser_yylex(parser_state *p) ...@@ -6422,15 +6422,17 @@ parser_yylex(parser_state *p)
nvars = nvars->cdr; nvars = nvars->cdr;
} }
nvar = intn(p->nvars->car); nvar = intn(p->nvars->car);
if (nvar == -1) { if (nvar != -2) { /* numbered parameters never appear on toplevel */
yywarning(p, "numbered parameter used in inner block"); if (nvar == -1) {
} yywarning(p, "numbered parameter used in inner block");
else { }
p->nvars->car = nint(nvar > n ? nvar : n); else {
p->nvars->car = nint(nvar > n ? nvar : n);
}
pylval.num = n;
p->lstate = EXPR_END;
return tNUMPARAM;
} }
pylval.num = n;
p->lstate = EXPR_END;
return tNUMPARAM;
} }
} }
/* fall through */ /* fall through */
......
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