Prevent mixin failure on null/undefined supertype properties
parent
172e2e2afe
commit
903a1a135c
|
@ -735,7 +735,7 @@ function mixMethods( src, dest, vis, iname, inparent )
|
|||
// TODO: this is a kluge; we'll use proper reflection eventually,
|
||||
// but for now, this is how we determine if this is an actual method
|
||||
// vs. something that just happens to be on the visibility object
|
||||
if ( !( src[ f ].___$$keywords$$ ) )
|
||||
if ( !( src[ f ] && src[ f ].___$$keywords$$ ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -167,6 +167,28 @@ require( 'common' ).testCase(
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
* This test unfortunately relies on certain implementation details;
|
||||
* we're testing at a high level here.
|
||||
*
|
||||
* When determining what methods need to be proxied for a mixin, ease.js
|
||||
* checks certain properties of the supertype. If the value is
|
||||
* null/undefined, then it is not an object, and cannot have any such
|
||||
* properties.
|
||||
*/
|
||||
'Trait mixin handles supertype null values': function()
|
||||
{
|
||||
// note the null value
|
||||
var C = this.Class( { foo: null, bar: undefined } ),
|
||||
T = this.Sut.extend( C, {} );
|
||||
|
||||
this.assertDoesNotThrow( function()
|
||||
{
|
||||
C.use( T )();
|
||||
} );
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* This is a corollary, but is still worth testing for assurance.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue