File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 var HAS_SYMBOLS = typeof Object . getOwnPropertySymbols === 'function' ;
1919
2020 function makeSuper ( _super , old , name , fn ) {
21+ var isFunction = typeof old === 'function' ;
2122 var newMethod = function ( ) {
2223 var tmp = this . _super ;
2324
2425 // Add a new ._super() method that is the same method
2526 // but either pointing to the prototype method
2627 // or to the overwritten method
27- this . _super = ( typeof old === 'function' ) ? old : _super [ name ] ;
28+ this . _super = isFunction ? old : _super [ name ] ;
2829
2930 // The method only need to be bound temporarily, so we
3031 // remove it when we're done executing
3536 return ret ;
3637 } ;
3738
38- Object . getOwnPropertySymbols ( old ) . forEach ( function ( name ) {
39- newMethod [ name ] = old [ name ] ;
40- } ) ;
39+ if ( isFunction ) {
40+ Object . getOwnPropertySymbols ( old ) . forEach ( function ( name ) {
41+ newMethod [ name ] = old [ name ] ;
42+ } ) ;
43+ }
4144
4245 return newMethod ;
4346 }
Original file line number Diff line number Diff line change @@ -48,12 +48,16 @@ describe('UberProto', function () {
4848 Obj . mixin ( {
4949 test : function ( ) {
5050 return this . _super ( ) + ' mixed in' ;
51+ } ,
52+ otherTest : function ( ) {
53+ return typeof this . _super === 'function' ;
5154 }
5255 } ) ;
5356
5457 assert . equal ( inst . test ( ) , 'Tester mixed in' ) ;
5558 assert . ok ( Obj . test [ testProp ] , 'Symbol conserved on method (Obj)' ) ;
5659 assert . ok ( inst . test [ testProp ] , 'Symbol conserved on method (inst)' ) ;
60+ assert . ok ( ! inst . otherTest ( ) ) ;
5761 } ) ;
5862
5963 it ( 'creates a new object' , function ( ) {
You can’t perform that action at this time.
0 commit comments