Skip to content

Commit

Permalink
Split the optimizable range item conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Feb 16, 2020
1 parent 07179c5 commit 0bfa479
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion compile.c
Expand Up @@ -5180,7 +5180,15 @@ compile_named_capture_assign(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE
static int
optimizable_range_item_p(const NODE *n)
{
return (n && nd_type(n) == NODE_LIT && RB_INTEGER_TYPE_P(n->nd_lit)) || (n && nd_type(n) == NODE_NIL);
if (!n) return FALSE;
switch (nd_type(n)) {
case NODE_LIT:
return RB_INTEGER_TYPE_P(n->nd_lit);
case NODE_NIL:
return TRUE;
default:
return FALSE;
}
}

static int
Expand Down

0 comments on commit 0bfa479

Please sign in to comment.