ruby-changes:30285
From: usa <ko1@a...>
Date: Fri, 2 Aug 2013 23:58:21 +0900 (JST)
Subject: [ruby-changes:30285] usa:r42337 (trunk): * vm.c (m_core_define_method, m_core_define_singleton_method): now
usa 2013-08-02 23:58:11 +0900 (Fri, 02 Aug 2013) New Revision: 42337 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42337 Log: * vm.c (m_core_define_method, m_core_define_singleton_method): now the value of def-expr is the Symbol of the name of the method, not nil. ref. [ruby-dev:42151] [Feature #3753] * test/ruby/test_syntax.rb (TestSyntax#test_value_of_def): test for above changes. Modified files: trunk/ChangeLog trunk/test/ruby/test_syntax.rb trunk/vm.c Index: ChangeLog =================================================================== --- ChangeLog (revision 42336) +++ ChangeLog (revision 42337) @@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Aug 2 23:57:57 2013 NAKAMURA Usaku <usa@r...> + + * vm.c (m_core_define_method, m_core_define_singleton_method): now + the value of def-expr is the Symbol of the name of the method, not + nil. + ref. [ruby-dev:42151] [Feature #3753] + + * test/ruby/test_syntax.rb (TestSyntax#test_value_of_def): test for + above changes. + Fri Aug 2 23:54:11 2013 Masaki Matsushita <glass.saga@g...> * array.c (rb_ary_zip): performance improvement by avoiding Index: vm.c =================================================================== --- vm.c (revision 42336) +++ vm.c (revision 42337) @@ -2052,7 +2052,7 @@ m_core_define_method(VALUE self, VALUE c https://github.com/ruby/ruby/blob/trunk/vm.c#L2052 REWIND_CFP({ vm_define_method(GET_THREAD(), cbase, SYM2ID(sym), iseqval, 0, rb_vm_cref()); }); - return Qnil; + return sym; } static VALUE @@ -2061,7 +2061,7 @@ m_core_define_singleton_method(VALUE sel https://github.com/ruby/ruby/blob/trunk/vm.c#L2061 REWIND_CFP({ vm_define_method(GET_THREAD(), cbase, SYM2ID(sym), iseqval, 1, rb_vm_cref()); }); - return Qnil; + return sym; } static VALUE Index: test/ruby/test_syntax.rb =================================================================== --- test/ruby/test_syntax.rb (revision 42336) +++ test/ruby/test_syntax.rb (revision 42337) @@ -370,6 +370,13 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L370 end end + def test_value_of_def + assert_separately [], <<-EOS + assert_equal(:foo, (def foo; end)) + assert_equal(:foo, (def (Object.new).foo; end)) + EOS + end + private def not_label(x) @result = x; @not_label ||= nil end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/