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

Put same frozen Range literal if possible

Range literal is now frozen so we can reuse same Range object if
the begin and the last are Numeric (frozen), such as `(1..2)`.
This commit is contained in:
Koichi Sasada 2020-09-26 00:53:07 +09:00
parent c881678cd7
commit 8d76b729a1
Notes: git 2020-10-02 09:22:42 +09:00

View file

@ -8644,8 +8644,8 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
VALUE flag = INT2FIX(excl);
const NODE *b = node->nd_beg;
const NODE *e = node->nd_end;
// TODO: Ractor can not use cached Range objects
if (0 && optimizable_range_item_p(b) && optimizable_range_item_p(e)) {
if (optimizable_range_item_p(b) && optimizable_range_item_p(e)) {
if (!popped) {
VALUE bv = nd_type(b) == NODE_LIT ? b->nd_lit : Qnil;
VALUE ev = nd_type(e) == NODE_LIT ? e->nd_lit : Qnil;