1
0
Fork 0

Member builder uses public prototype by default

closure/master
Mike Gerwitz 2011-01-20 21:50:52 -05:00
parent f27b0b01ab
commit 7f92a76e1f
2 changed files with 21 additions and 5 deletions

View File

@ -39,11 +39,7 @@
*/ */
exports.buildProp = function( members, meta, name, value, keywords ) exports.buildProp = function( members, meta, name, value, keywords )
{ {
if ( keywords[ 'public' ] ) if ( keywords[ 'protected' ] )
{
members[ 'public' ][ name ] = value;
}
else if ( keywords[ 'protected' ] )
{ {
members[ 'protected' ][ name ] = value; members[ 'protected' ][ name ] = value;
} }
@ -51,5 +47,11 @@ exports.buildProp = function( members, meta, name, value, keywords )
{ {
members[ 'private' ][ name ] = value; members[ 'private' ][ name ] = value;
} }
else
{
// public keyword is the default, so explicitly specifying it is only
// for clarity
members[ 'public' ][ name ] = value;
}
}; };

View File

@ -41,6 +41,8 @@ var common = require( './common' ),
*/ */
function buildPropQuick( keywords ) function buildPropQuick( keywords )
{ {
keywords = keywords || {};
return buildProp( members, meta, name, value, keywords ); return buildProp( members, meta, name, value, keywords );
} }
@ -86,3 +88,15 @@ function buildPropQuick( keywords )
); );
} )(); } )();
( function testCopiedIntoPublicPrototypeByDefault()
{
buildPropQuick();
assert.equal(
members[ 'public' ][ name ],
value,
"Properties are copied to the public member prototype by default"
);
} )();