1
0
Fork 0

Public-required members are now stored in a hash

closure/master
Mike Gerwitz 2011-03-28 18:21:06 -04:00
parent 8cd25b1bc4
commit 030b207f8f
1 changed files with 12 additions and 3 deletions

View File

@ -60,7 +60,14 @@ var util = require( __dirname + '/util' ),
*
* @type {Object.<string,boolean>}
*/
reserved = { '__initProps': true }
reserved = { '__initProps': true },
/**
* Hash of members that must be public
*
* @type {Object.<string,boolean}
*/
public_members = { '__construct': true }
;
@ -389,11 +396,13 @@ function buildMembers(
method: function( name, func, is_abstract, keywords )
{
// constructor check
if ( name === '__construct' )
if ( public_members[ name ] === true )
{
if ( keywords[ 'protected' ] || keywords[ 'private' ] )
{
throw TypeError( "Constructor must be public" );
throw TypeError(
name + " must be public"
);
}
}