diff options
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -472,6 +472,7 @@ static NODE *new_array_pattern(struct parser_params *p, NODE *constant, NODE *pr static NODE *new_array_pattern_tail(struct parser_params *p, NODE *pre_args, int has_rest, ID rest_arg, NODE *post_args, const YYLTYPE *loc); static NODE *new_hash_pattern(struct parser_params *p, NODE *constant, NODE *hshptn, const YYLTYPE *loc); static NODE *new_hash_pattern_tail(struct parser_params *p, NODE *kw_args, ID kw_rest_arg, const YYLTYPE *loc); +static NODE *new_case3(struct parser_params *p, NODE *val, NODE *pat, const YYLTYPE *loc); static NODE *new_kw_arg(struct parser_params *p, NODE *k, const YYLTYPE *loc); static NODE *args_with_numbered(struct parser_params*,NODE*,int); @@ -1572,8 +1573,7 @@ expr : command_call { p->in_kwarg = !!$<num>3; /*%%%*/ - $$ = NEW_CASE3($1, NEW_IN($5, 0, 0, &@5), &@$); - rb_warn0L(nd_line($$), "Pattern matching is experimental, and the behavior may change in future versions of Ruby!"); + $$ = new_case3(p, $1, NEW_IN($5, 0, 0, &@5), &@$); /*% %*/ /*% ripper: case!($1, in!($5, Qnil, Qnil)) %*/ } @@ -2860,8 +2860,7 @@ primary : literal k_end { /*%%%*/ - $$ = NEW_CASE3($2, $4, &@$); - rb_warn0L(nd_line($$), "Pattern matching is experimental, and the behavior may change in future versions of Ruby!"); + $$ = new_case3(p, $2, $4, &@$); /*% %*/ /*% ripper: case!($2, $4) %*/ } @@ -11453,6 +11452,15 @@ new_hash_pattern_tail(struct parser_params *p, NODE *kw_args, ID kw_rest_arg, co return node; } +static NODE * +new_case3(struct parser_params *p, NODE *val, NODE *pat, const YYLTYPE *loc) +{ + NODE *node = NEW_CASE3(val, pat, loc); + + rb_warn0L(nd_line(node), "Pattern matching is experimental, and the behavior may change in future versions of Ruby!"); + return node; +} + static NODE* dsym_node(struct parser_params *p, NODE *node, const YYLTYPE *loc) { |