1
0
Fork 0

Prevent mixin failure on null/undefined supertype properties

master
Mike Gerwitz 2015-10-26 22:17:28 -04:00
parent 172e2e2afe
commit 903a1a135c
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
2 changed files with 23 additions and 1 deletions

View File

@ -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;
}

View File

@ -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.
*