Public-required members are now stored in a hash
parent
8cd25b1bc4
commit
030b207f8f
|
@ -60,7 +60,14 @@ var util = require( __dirname + '/util' ),
|
||||||
*
|
*
|
||||||
* @type {Object.<string,boolean>}
|
* @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 )
|
method: function( name, func, is_abstract, keywords )
|
||||||
{
|
{
|
||||||
// constructor check
|
// constructor check
|
||||||
if ( name === '__construct' )
|
if ( public_members[ name ] === true )
|
||||||
{
|
{
|
||||||
if ( keywords[ 'protected' ] || keywords[ 'private' ] )
|
if ( keywords[ 'protected' ] || keywords[ 'private' ] )
|
||||||
{
|
{
|
||||||
throw TypeError( "Constructor must be public" );
|
throw TypeError(
|
||||||
|
name + " must be public"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue