Member builder uses public prototype by default
parent
f27b0b01ab
commit
7f92a76e1f
|
@ -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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
);
|
||||||
|
} )();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue