aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-03 23:56:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-03 23:56:11 +0000
commit27023fce265ad0923e6b8c80c20d6be19290b1f5 (patch)
treeba8a84b5162cd36c4dedab538c0c951168336024 /compile.c
parent3f6f9cac047f51ecac728f4af0f734faa3d4ccf9 (diff)
downloadruby-27023fce265ad0923e6b8c80c20d6be19290b1f5.tar.gz
vm.c: simplified core#hash_merge_kwd
* vm.c (core_hash_merge_kwd): simplified to merge the second hash into the first hash. * compile.c (compile_array): call core#hash_merge_kwd with 2 hashes always, by passing an new empty hash to at the first iteration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/compile.c b/compile.c
index 21971830ea..ea6b74d18d 100644
--- a/compile.c
+++ b/compile.c
@@ -3989,18 +3989,17 @@ compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node_ro
}
}
if (kw) {
- VALUE nhash = (i > 0 || !first) ? INT2FIX(2) : INT2FIX(1);
if (!popped) {
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
if (i > 0 || !first) ADD_INSN(ret, line, swap);
+ else ADD_INSN1(ret, line, newhash, INT2FIX(0));
}
COMPILE(ret, "keyword splat", kw);
if (popped) {
ADD_INSN(ret, line, pop);
}
else {
- ADD_SEND(ret, line, id_core_hash_merge_kwd, nhash);
- if (nhash == INT2FIX(1)) ADD_SEND(ret, line, rb_intern("dup"), INT2FIX(0));
+ ADD_SEND(ret, line, id_core_hash_merge_kwd, INT2FIX(2));
}
}
first = 0;