diff --git a/lib/Trait.js b/lib/Trait.js index 7794b84..0304a6b 100644 --- a/lib/Trait.js +++ b/lib/Trait.js @@ -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; } diff --git a/test/Trait/ClassExtendTest.js b/test/Trait/ClassExtendTest.js index ceea701..cfcc0cf 100644 --- a/test/Trait/ClassExtendTest.js +++ b/test/Trait/ClassExtendTest.js @@ -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. *