Now storing reserved names in a hash
parent
cea9ca906f
commit
8cd25b1bc4
|
@ -50,7 +50,17 @@ var util = require( __dirname + '/util' ),
|
||||||
*
|
*
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
extending = false
|
extending = false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hash of reserved members
|
||||||
|
*
|
||||||
|
* These methods cannot be defined in the class. They are for internal use
|
||||||
|
* only.
|
||||||
|
*
|
||||||
|
* @type {Object.<string,boolean>}
|
||||||
|
*/
|
||||||
|
reserved = { '__initProps': true }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -329,11 +339,11 @@ function buildMembers(
|
||||||
each: function( name, value, keywords )
|
each: function( name, value, keywords )
|
||||||
{
|
{
|
||||||
// disallow use of our internal __initProps() method
|
// disallow use of our internal __initProps() method
|
||||||
if ( name === '__initProps' )
|
if ( reserved[ name ] === true )
|
||||||
{
|
{
|
||||||
throw new Error(
|
throw Error(
|
||||||
( ( cname ) ? cname + '::' : '' ) +
|
( ( cname ) ? cname + '::' : '' ) +
|
||||||
"__initProps is a reserved method"
|
( name + " is reserved" )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue