Project

General

Profile

Feature #12996 ยป range_eqq2.patch

ksss (Yuki Kurihara), 05/17/2017 02:14 PM

View differences:

range.c
1098 1098
    return rb_exec_recursive(inspect_range, range, 0);
1099 1099
}
1100 1100

  
1101
VALUE rb_str_include_range_p(VALUE beg, VALUE end, VALUE val, VALUE exclusive);
1102

  
1101 1103
/*
1102 1104
 *  call-seq:
1103 1105
 *     rng === obj       ->  true or false
......
1120 1122
static VALUE
1121 1123
range_eqq(VALUE range, VALUE val)
1122 1124
{
1125
    VALUE beg = RANGE_BEG(range);
1126
    VALUE end = RANGE_END(range);
1127
    if (FIXNUM_P(beg) || FIXNUM_P(end)) {
1128
	return r_cover_p(range, beg, end, val);
1129
    }
1130
    else if (RB_TYPE_P(beg, T_STRING) && RB_TYPE_P(end, T_STRING)) {
1131
	return rb_str_include_range_p(beg, end, val, RANGE_EXCL(range));
1132
    }
1123 1133
    return rb_funcall(range, rb_intern("include?"), 1, val);
1124 1134
}
1125 1135

  
......
1152 1162
	return r_cover_p(range, beg, end, val);
1153 1163
    }
1154 1164
    else if (RB_TYPE_P(beg, T_STRING) && RB_TYPE_P(end, T_STRING)) {
1155
	VALUE rb_str_include_range_p(VALUE beg, VALUE end, VALUE val, VALUE exclusive);
1156 1165
	return rb_str_include_range_p(beg, end, val, RANGE_EXCL(range));
1157 1166
    }
1158 1167
    /* TODO: ruby_frame->this_func = rb_intern("include?"); */