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

ruby-changes:35493

From: nobu <ko1@a...>
Date: Sat, 13 Sep 2014 22:07:13 +0900 (JST)
Subject: [ruby-changes:35493] nobu:r47575 (trunk): class.c: simplify

nobu	2014-09-13 22:07:04 +0900 (Sat, 13 Sep 2014)

  New Revision: 47575

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

  Log:
    class.c: simplify
    
    * class.c (singleton_class_of): use local variable and remove
      duplicated member access.

  Modified files:
    trunk/class.c
Index: class.c
===================================================================
--- class.c	(revision 47574)
+++ class.c	(revision 47575)
@@ -1561,12 +1561,10 @@ singleton_class_of(VALUE obj) https://github.com/ruby/ruby/blob/trunk/class.c#L1561
 	}
     }
 
-    if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON) &&
-	rb_ivar_get(RBASIC(obj)->klass, id_attached) == obj) {
-	klass = RBASIC(obj)->klass;
-    }
-    else {
-	klass = rb_make_metaclass(obj, RBASIC(obj)->klass);
+    klass = RBASIC(obj)->klass;
+    if (!(FL_TEST(klass, FL_SINGLETON) &&
+	  rb_ivar_get(klass, id_attached) == obj)) {
+	klass = rb_make_metaclass(obj, klass);
     }
 
     if (OBJ_TAINTED(obj)) {

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

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