diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-09-07 23:57:37 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-09-08 00:28:03 +0900 |
commit | 050f67c9c634fc0064c49f79ecb49588676028ec (patch) | |
tree | 42c47c39a31e105dc5eccd7ccdc169ce52a6fad3 /compile.c | |
parent | bb78c8367802335ec17c39b228e0f535b6e23cb4 (diff) |
compile.c (compile_hash): Simplify the keyword handling
The length of NODE_LIST chain in NODE_HASH is always even because it
represents key-value pairs. There is no need to check for the
odd-length case.
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -4083,19 +4083,16 @@ compile_hash(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int popp } if (!node->nd_head) { - kw = node->nd_next; num_kw++; - node = 0; - if (kw) { - opt_p = 0; - node = kw->nd_next; - kw = kw->nd_head; - if (!single_kw && !node) { - single_kw = 1; - } + opt_p = 0; + kw = node->nd_next->nd_head; + node = node->nd_next->nd_next; + if (!single_kw && !node) { + single_kw = 1; } break; } + if (opt_p && !static_literal_node_p(node, iseq)) { opt_p = 0; } |