1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

apinfo/fpinfo should always be non-NULL

This commit is contained in:
Kazuki Tsujimoto 2020-06-14 13:06:42 +09:00
parent ddded1157a
commit 97614c5521
No known key found for this signature in database
GPG key ID: BCEA306C49B81CD7

20
parse.y
View file

@ -830,13 +830,11 @@ new_array_pattern(struct parser_params *p, VALUE constant, VALUE pre_arg, VALUE
{
NODE *t = (NODE *)aryptn;
struct rb_ary_pattern_info *apinfo = t->nd_apinfo;
VALUE pre_args = Qnil, rest_arg = Qnil, post_args = Qnil;
VALUE pre_args, rest_arg, post_args;
if (apinfo) {
pre_args = rb_ary_entry(apinfo->imemo, 0);
rest_arg = rb_ary_entry(apinfo->imemo, 1);
post_args = rb_ary_entry(apinfo->imemo, 2);
}
pre_args = rb_ary_entry(apinfo->imemo, 0);
rest_arg = rb_ary_entry(apinfo->imemo, 1);
post_args = rb_ary_entry(apinfo->imemo, 2);
if (!NIL_P(pre_arg)) {
if (!NIL_P(pre_args)) {
@ -878,13 +876,11 @@ new_find_pattern(struct parser_params *p, VALUE constant, VALUE fndptn, const YY
{
NODE *t = (NODE *)fndptn;
struct rb_fnd_pattern_info *fpinfo = t->nd_fpinfo;
VALUE pre_rest_arg = Qnil, args = Qnil, post_rest_arg = Qnil;
VALUE pre_rest_arg, args, post_rest_arg;
if (fpinfo) {
pre_rest_arg = rb_ary_entry(fpinfo->imemo, 0);
args = rb_ary_entry(fpinfo->imemo, 1);
post_rest_arg = rb_ary_entry(fpinfo->imemo, 2);
}
pre_rest_arg = rb_ary_entry(fpinfo->imemo, 0);
args = rb_ary_entry(fpinfo->imemo, 1);
post_rest_arg = rb_ary_entry(fpinfo->imemo, 2);
return dispatch4(fndptn, constant, pre_rest_arg, args, post_rest_arg);
}