File tree 1 file changed +8
-19
lines changed
1 file changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -512,32 +512,22 @@ def respond_to?(name, include_all = false)
512
512
513
513
def singleton_class
514
514
%x{
515
- if (self._isClass) {
516
- if (self.__meta__) {
517
- return self.__meta__;
518
- }
515
+ if (self.__meta__) {
516
+ return self.__meta__;
517
+ }
519
518
519
+ if (self._isClass) {
520
520
var meta = new $opal.Class._alloc;
521
521
meta._klass = $opal.Class;
522
- self.__meta__ = meta;
522
+
523
523
// FIXME - is this right? (probably - methods defined on
524
524
// class' singleton should also go to subclasses?)
525
525
meta._proto = self.constructor.prototype;
526
+
526
527
meta._isSingleton = true;
527
528
meta.__inc__ = [];
528
529
meta._methods = [];
529
-
530
530
meta._scope = self._scope;
531
-
532
- return meta;
533
- }
534
-
535
- if (self._isClass) {
536
- return self._klass;
537
- }
538
-
539
- if (self.__meta__) {
540
- return self.__meta__;
541
531
}
542
532
543
533
else {
@@ -549,13 +539,12 @@ def singleton_class
549
539
meta._name = class_id;
550
540
551
541
meta._proto = self;
552
- self.__meta__ = meta;
553
542
meta._klass = orig_class._klass;
554
543
meta._scope = orig_class._scope;
555
544
meta.__parent = orig_class;
556
-
557
- return meta;
558
545
}
546
+
547
+ return self.__meta__ = meta;
559
548
}
560
549
end
561
550
You can’t perform that action at this time.
0 commit comments