ruby-changes:39109
From: normal <ko1@a...>
Date: Wed, 8 Jul 2015 04:51:04 +0900 (JST)
Subject: [ruby-changes:39109] normal:r51190 (trunk): iseq.c (iseq_data_to_ary): dump kw_arg as symbol
normal 2015-07-08 04:50:49 +0900 (Wed, 08 Jul 2015) New Revision: 51190 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51190 Log: iseq.c (iseq_data_to_ary): dump kw_arg as symbol Fix RubyVM::InstructionSequence#to_a after r49517 Keywords were made symbols to fix [Bug #10831] [ruby-core:68031], so we should dump symbols as-is instead of attempting to convert them from IDs * iseq.c (iseq_data_to_ary): dump kw_arg as symbol * test/-ext-/iseq_load/test_iseq_load.rb: test kw_arg roundtrip [ruby-core:69891] [Bug #11338] Modified files: trunk/ChangeLog trunk/iseq.c trunk/test/-ext-/iseq_load/test_iseq_load.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 51189) +++ ChangeLog (revision 51190) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Jul 8 04:42:27 2015 Eric Wong <e@8...> + + * iseq.c (iseq_data_to_ary): dump kw_arg as symbol + * test/-ext-/iseq_load/test_iseq_load.rb: test kw_arg roundtrip + [ruby-core:69891] [Bug #11338] + Tue Jul 7 18:18:41 2015 Kazuhiro NISHIYAMA <zn@m...> * random.c (fill_random_bytes_syscall): fix compile error. Index: iseq.c =================================================================== --- iseq.c (revision 51189) +++ iseq.c (revision 51190) @@ -1795,7 +1795,7 @@ iseq_data_to_ary(rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/iseq.c#L1795 orig_argc -= ci->kw_arg->keyword_len; for (i = 0; i < ci->kw_arg->keyword_len; i++) { - rb_ary_push(kw, ID2SYM(ci->kw_arg->keywords[i])); + rb_ary_push(kw, ci->kw_arg->keywords[i]); } rb_hash_aset(e, ID2SYM(rb_intern("kw_arg")), kw); } Index: test/-ext-/iseq_load/test_iseq_load.rb =================================================================== --- test/-ext-/iseq_load/test_iseq_load.rb (revision 51189) +++ test/-ext-/iseq_load/test_iseq_load.rb (revision 51190) @@ -86,6 +86,15 @@ class TestIseqLoad < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/-ext-/iseq_load/test_iseq_load.rb#L86 assert_iseq_roundtrip(src) end + def test_kwarg + assert_iseq_roundtrip <<-'end;' + def foo(kwarg: :foo) + kwarg + end + foo(kwarg: :bar) + end; + end + # FIXME: still failing def test_require_integration skip "iseq loader require integration tests still failing" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/