1
0
Fork 0

Now storing reserved names in a hash

closure/master
Mike Gerwitz 2011-03-28 18:18:40 -04:00
parent cea9ca906f
commit 8cd25b1bc4
1 changed files with 14 additions and 4 deletions

View File

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