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

Split the optimizable range item conditions

This commit is contained in:
Nobuyoshi Nakada 2020-02-16 13:47:18 +09:00
parent 07179c5c0f
commit 0bfa479c52
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -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