diff options
author | Nobuyoshi Nakada <[email protected]> | 2020-02-16 13:47:18 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2020-02-16 13:47:18 +0900 |
commit | 0bfa479c52963b95a47ceab3d453f21b646366a2 (patch) | |
tree | 39aa3bbc5434467d4a6d07e8db6778e1488965a0 /compile.c | |
parent | 07179c5c0fdee86650446aa373c3c2d5331600d6 (diff) |
Split the optimizable range item conditions
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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 |