summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-26 01:55:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-26 01:55:34 +0000
commit37e432b5bf4d873a987738891d86f588e97a53a6 (patch)
tree878c034361d86a25b303d677c1161b7575f64344 /compile.c
parent3bd10c6ee7a4d05e25610690f52efe4557dd8ed2 (diff)
compile.c: non-destructive keyword splat
* compile.c (compile_array_): make copy a first hash not to modify the argument itself. keyword splat should be non-destructive. [ruby-core:62161] [Bug #9776] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 55f500b489..d30966db35 100644
--- a/compile.c
+++ b/compile.c
@@ -2479,6 +2479,7 @@ compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root,
if (i > 0 || !first) ADD_INSN(ret, line, swap);
COMPILE(ret, "keyword splat", kw);
ADD_SEND(ret, line, ID2SYM(id_core_hash_merge_kwd), nhash);
+ if (nhash == INT2FIX(1)) ADD_SEND(ret, line, ID2SYM(rb_intern("dup")), INT2FIX(0));
}
first = 0;
break;