diff --git a/lib/class.js b/lib/class.js index 716b6d8..557ff5c 100644 --- a/lib/class.js +++ b/lib/class.js @@ -96,6 +96,17 @@ var extend = ( function( extending ) var properties = {}; util.propCopy( props, prototype, result_data, { + each: function( name, value ) + { + // disallow use of our internal __initProps() method + if ( name === '__initProps' ) + { + throw new Error( "__initProps is a reserved method" ); + } + + this.performDefault( name, value ); + }, + property: function( name, value ) { properties[ name ] = value; diff --git a/test/test-class-extend.js b/test/test-class-extend.js index 8dccbfa..1e70c8e 100644 --- a/test/test-class-extend.js +++ b/test/test-class-extend.js @@ -185,3 +185,11 @@ assert.ok( "Subtypes can override parent property values" ); +assert.throws( function() +{ + Class.extend( + { + __initProps: function() {}, + }); +}, Error, "__initProps() cannot be declared (internal method)" ); +