aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y14
1 files changed, 14 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 4dfdd5d2a3..c7c43e3278 100644
--- a/parse.y
+++ b/parse.y
@@ -3245,6 +3245,10 @@ block_args_tail : f_block_kwarg ',' f_kwrest opt_f_block_arg
{
$$ = new_args_tail(p, Qnone, $1, $2, &@1);
}
+ | f_no_kwarg opt_f_block_arg
+ {
+ $$ = new_args_tail(p, Qnone, rb_intern("nil"), $2, &@1);
+ }
| f_block_arg
{
$$ = new_args_tail(p, Qnone, Qnone, $1, &@1);
@@ -4712,6 +4716,10 @@ args_tail : f_kwarg ',' f_kwrest opt_f_block_arg
{
$$ = new_args_tail(p, Qnone, $1, $2, &@1);
}
+ | f_no_kwarg opt_f_block_arg
+ {
+ $$ = new_args_tail(p, Qnone, rb_intern("nil"), $2, &@1);
+ }
| f_block_arg
{
$$ = new_args_tail(p, Qnone, Qnone, $1, &@1);
@@ -4968,6 +4976,9 @@ kwrest_mark : tPOW
| tDSTAR
;
+f_no_kwarg : kwrest_mark keyword_nil
+ ;
+
f_kwrest : kwrest_mark tIDENTIFIER
{
arg_var(p, shadowing_lvar(p, get_id($2)));
@@ -11125,6 +11136,9 @@ new_args_tail(struct parser_params *p, NODE *kw_args, ID kw_rest_arg, ID block,
args->kw_rest_arg = NEW_DVAR(kw_rest_arg, loc);
args->kw_rest_arg->nd_cflag = kw_bits;
}
+ else if (kw_rest_arg == rb_intern("nil")) {
+ args->no_kwarg = 1;
+ }
else if (kw_rest_arg) {
args->kw_rest_arg = NEW_DVAR(kw_rest_arg, loc);
}