Split the optimizable range item conditions
This commit is contained in:
parent
07179c5c0f
commit
0bfa479c52
10
compile.c
10
compile.c
@ -5180,7 +5180,15 @@ compile_named_capture_assign(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE
|
|||||||
static int
|
static int
|
||||||
optimizable_range_item_p(const NODE *n)
|
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
|
static int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user