[前][次][番号順一覧][スレッド一覧]

ruby-changes:19870

From: nobu <ko1@a...>
Date: Sat, 4 Jun 2011 11:31:10 +0900 (JST)
Subject: [ruby-changes:19870] nobu:r31917 (trunk): * class.c (check_mix_method_i, do_mix_method_i): not mix methods

nobu	2011-06-04 11:30:59 +0900 (Sat, 04 Jun 2011)

  New Revision: 31917

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31917

  Log:
    * class.c (check_mix_method_i, do_mix_method_i): not mix methods
      renamed as nil.

  Modified files:
    trunk/ChangeLog
    trunk/class.c
    trunk/test/ruby/test_module.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31916)
+++ ChangeLog	(revision 31917)
@@ -1,3 +1,8 @@
+Sat Jun  4 11:30:57 2011  Nobuyoshi Nakada  <nobu@r...>
+
+	* class.c (check_mix_method_i, do_mix_method_i): not mix methods
+	  renamed as nil.
+
 Sat Jun  4 04:04:41 2011  NARUSE, Yui  <naruse@r...>
 
 	* test/rubygems/test_gem_commands_which_command.rb:
Index: class.c
===================================================================
--- class.c	(revision 31916)
+++ class.c	(revision 31917)
@@ -745,6 +745,7 @@
     st_data_t alias;
 
     if (aliasing && st_lookup(aliasing, ID2SYM(id), &alias)) {
+	if (NIL_P(alias)) return ST_CONTINUE;
 	id = rb_to_id(alias);
     }
     if (st_lookup(argp->mtbl, id, NULL)) {
@@ -763,6 +764,7 @@
     st_data_t old, alias;
 
     if (aliasing && st_lookup(aliasing, ID2SYM(id), &alias)) {
+	if (NIL_P(alias)) return ST_CONTINUE;
 	id = rb_to_id(alias);
     }
     if (st_lookup(argp->mtbl, id, &old)) {
Index: test/ruby/test_module.rb
===================================================================
--- test/ruby/test_module.rb	(revision 31916)
+++ test/ruby/test_module.rb	(revision 31917)
@@ -1096,5 +1096,20 @@
         mix japanese, :address => :jp_address, :address= => :jp_address=
       }
     }
+
+    japanese_american = Class.new
+    assert_nothing_raised(ArgumentError) {
+      japanese_american.class_eval {
+        mix japanese, :address => nil, :address= => nil
+      }
+    }
+    assert_raise(NoMethodError) {
+      japanese_american.new.address
+    }
+    assert_nothing_raised(ArgumentError) {
+      japanese_american.class_eval {
+        mix american
+      }
+    }
   end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]