summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-22 11:01:13 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-22 11:01:13 +0000
commit526cc900922d5a316818bcacbf52b088f561a147 (patch)
treefc0e241d088d5e01a8ac416ad9c8a632e9271929 /compile.c
parenta7cef95f5cae8c6bba2a8eab6e3f906ab3c6c193 (diff)
merge revision(s) 62333: [Backport #14459]
compile.c: popped hash * compile.c (compile_array): skip creating new hash if preceeding elements are popped all. [ruby-core:85486] [Bug #14459] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/compile.c b/compile.c
index 26bfa5e396..98d732d087 100644
--- a/compile.c
+++ b/compile.c
@@ -3649,14 +3649,20 @@ compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node_ro
case COMPILE_ARRAY_TYPE_HASH:
if (i > 0) {
if (first) {
- ADD_INSN1(anchor, line, newhash, INT2FIX(i));
+ if (!popped) {
+ ADD_INSN1(anchor, line, newhash, INT2FIX(i));
+ }
APPEND_LIST(ret, anchor);
}
else {
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN(ret, line, swap);
+ if (!popped) {
+ ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN(ret, line, swap);
+ }
APPEND_LIST(ret, anchor);
- ADD_SEND(ret, line, id_core_hash_merge_ptr, INT2FIX(i + 1));
+ if (!popped) {
+ ADD_SEND(ret, line, id_core_hash_merge_ptr, INT2FIX(i + 1));
+ }
}
}
if (kw) {