ruby-changes:57655
From: Yusuke <ko1@a...>
Date: Sun, 8 Sep 2019 00:28:24 +0900 (JST)
Subject: [ruby-changes:57655] 050f67c9c6 (master): compile.c (compile_hash): Simplify the keyword handling
https://git.ruby-lang.org/ruby.git/commit/?id=050f67c9c6 From 050f67c9c634fc0064c49f79ecb49588676028ec Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Sat, 7 Sep 2019 23:57:37 +0900 Subject: 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. diff --git a/compile.c b/compile.c index 0e10286..34cd858 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 https://github.com/ruby/ruby/blob/trunk/compile.c#L4083 } 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; } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/