summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-13 13:07:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-13 13:07:04 +0000
commitab22202a50397b24ee23e01b6f229b2893a28278 (patch)
tree961125db69457af525a866dd8221669b25b299f2 /class.c
parent4df147d6e8b6503b4a3068a3e9330e5d90ba3d87 (diff)
class.c: simplify
* class.c (singleton_class_of): use local variable and remove duplicated member access. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/class.c b/class.c
index 068caaf..d841328 100644
--- a/class.c
+++ b/class.c
@@ -1561,12 +1561,10 @@ singleton_class_of(VALUE obj)
}
}
- 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)) {