summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-24 16:10:40 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-24 16:10:40 +0000
commit03ec1e8eb879f93cb94c148d25d4986b2ed60c9a (patch)
treec370a47d5c9e763ae974af85ed0df8e318c48b78 /compile.c
parent8b5f0528a7b0b4740708e2e5b74e1e0c79eab45f (diff)
merge revision(s) 39627: [Backport #8008]
* compile.c (iseq_compile_each): pass keyword arguments to zsuper, with current values. [ruby-core:53114] [Bug #8008] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index fc5229fd9b..1aedf56d7f 100644
--- a/compile.c
+++ b/compile.c
@@ -4466,6 +4466,22 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
argc = INT2FIX(post_len + post_start);
}
}
+
+ if (liseq->arg_keyword > 0) {
+ int local_size = liseq->local_size;
+ int idx = local_size - liseq->arg_keyword;
+ argc++;
+ ADD_INSN1(args, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
+ ADD_SEND (args, line, ID2SYM(rb_intern("dup")), INT2FIX(0));
+ for (i = 0; i < liseq->arg_keywords; ++i) {
+ ID id = liseq->arg_keyword_table[i];
+ idx = local_size - get_local_var_idx(liseq, id);
+ ADD_INSN1(args, line, putobject, ID2SYM(id));
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
+ }
+ ADD_SEND(args, line, ID2SYM(id_core_hash_merge_ptr), INT2FIX(i * 2 + 1));
+ }
}
}