1
0
Fork 0

All interface members must now be public

closure/master
Mike Gerwitz 2011-03-19 00:58:42 -04:00
parent 5af833ab05
commit 4d2852627e
2 changed files with 34 additions and 0 deletions

View File

@ -236,6 +236,14 @@ var extend = ( function( extending )
); );
} }
// all members must be public
if ( keywords[ 'protected' ] || keywords[ 'private' ] )
{
throw TypeError(
iname + " member " + name + " must be public"
);
}
member_builder.buildMethod( member_builder.buildMethod(
members, null, name, value, keywords members, null, name, value, keywords
); );

View File

@ -205,3 +205,29 @@ for ( var i = 0; i < base_types.length; i++ )
} }
} )(); } )();
/**
* Interfaces represent a public API that must be implemented. It does not make
* sense to have members be anything but public.
*/
( function testInterfaceMembersMustBePublic()
{
// protected
assert.throws( function()
{
Interface(
{
'abstract protected foo': [],
} );
}, Error, "Interface members must be public (1)" );
// private
assert.throws( function()
{
Interface(
{
'abstract private foo': [],
} );
}, Error, "Interface members must be public (2)" );
} )();