File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -289,11 +289,21 @@ fake_class_p(VALUE klass)
289
289
return FL_TEST_RAW (klass , T_ICLASS | FL_SINGLETON );
290
290
}
291
291
292
+ static inline VALUE
293
+ class_real (VALUE cl )
294
+ {
295
+ RUBY_ASSERT (cl );
296
+ while (RB_UNLIKELY (fake_class_p (cl ))) {
297
+ cl = RCLASS_SUPER (cl );
298
+ }
299
+ return cl ;
300
+ }
301
+
292
302
VALUE
293
303
rb_class_real (VALUE cl )
294
304
{
295
- while ( RB_UNLIKELY ( cl && fake_class_p ( cl )) ) {
296
- cl = RCLASS_SUPER (cl );
305
+ if ( cl ) {
306
+ cl = class_real (cl );
297
307
}
298
308
return cl ;
299
309
}
@@ -302,21 +312,16 @@ VALUE
302
312
rb_obj_class (VALUE obj )
303
313
{
304
314
VALUE cl = CLASS_OF (obj );
305
- while ( RB_UNLIKELY ( cl && fake_class_p ( cl )) ) {
306
- cl = RCLASS_SUPER (cl );
315
+ if ( cl ) {
316
+ cl = class_real (cl );
307
317
}
308
318
return cl ;
309
319
}
310
320
311
321
VALUE
312
322
rb_obj_class_must (VALUE obj )
313
323
{
314
- VALUE cl = CLASS_OF (obj );
315
- RUBY_ASSERT (cl );
316
- while (RB_UNLIKELY (fake_class_p (cl ))) {
317
- cl = RCLASS_SUPER (cl );
318
- }
319
- return cl ;
324
+ return class_real (CLASS_OF (obj ));
320
325
}
321
326
322
327
/*
You can’t perform that action at this time.
0 commit comments