summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-09-07 23:57:37 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-09-08 00:28:03 +0900
commit050f67c9c634fc0064c49f79ecb49588676028ec (patch)
tree42c47c39a31e105dc5eccd7ccdc169ce52a6fad3 /compile.c
parentbb78c8367802335ec17c39b228e0f535b6e23cb4 (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.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/compile.c b/compile.c
index 0e10286a08..34cd858ba6 100644
--- a/compile.c
+++ b/compile.c
@@ -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;
}