parse.y: move numbered parameter indexing to lexer.

parent 5dfbfb3e
...@@ -712,10 +712,6 @@ new_cvar(parser_state *p, mrb_sym sym) ...@@ -712,10 +712,6 @@ new_cvar(parser_state *p, mrb_sym sym)
static node* static node*
new_nvar(parser_state *p, int num) new_nvar(parser_state *p, int num)
{ {
if (p->nvars) {
int nvars = intn(p->nvars->car);
p->nvars->car = nint(nvars > num ? nvars : num);
}
return cons((node*)NODE_NVAR, nint(num)); return cons((node*)NODE_NVAR, nint(num));
} }
...@@ -6429,6 +6425,9 @@ parser_yylex(parser_state *p) ...@@ -6429,6 +6425,9 @@ parser_yylex(parser_state *p)
if (nvar == -1) { if (nvar == -1) {
yywarning(p, "numbered parameter used in inner block"); yywarning(p, "numbered parameter used in inner block");
} }
else {
p->nvars->car = nint(nvar > n ? nvar : n);
}
pylval.num = n; pylval.num = n;
p->lstate = EXPR_END; p->lstate = EXPR_END;
return tNUMPARAM; return tNUMPARAM;
......
This diff is collapsed.
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