1
0
Fork 0

Altered abstract method declaration (using strings to represent arguments rather than a function)

closure/master
Mike Gerwitz 2010-12-01 21:13:51 -05:00
parent 837422c46f
commit 2e8097e21e
2 changed files with 8 additions and 6 deletions

View File

@ -194,13 +194,15 @@ exports.propCopy = function( props, dest, result_data )
* considered to be abstract and cannot be instantiated. It may only be
* extended.
*
* @param {Function} definition function definition that concrete
* @param {...string} definition function definition that concrete
* implementations must follow
*
* @return {Function}
*/
exports.createAbstractMethod = function( definition )
exports.createAbstractMethod = function()
{
var definition = Array.prototype.slice.call( arguments );
var method = function()
{
throw new Error( "Cannot call abstract method" );
@ -256,10 +258,10 @@ function method_override(
// if we were given a concrete method to an abstract method,
// then the method should no longer be considered abstract
if ( ( abstract_map[ name ] !== undefined )
&& ( new_method.abstractFlag !== true )
&& ( exports.isAbstractMethod( new_method.abstractFlag ) === false )
)
{
if ( super_method.definition instanceof Function )
if ( super_method.definition instanceof Array )
{
// ensure the concrete definition is compatible with
// that of its supertype

View File

@ -42,7 +42,7 @@ var AbstractFoo = Class.extend(
this.ctorCalled = true;
},
method: abstractMethod( function( one, two, three ){} ),
method: abstractMethod( 'one', 'two', 'three' ),
second: abstractMethod(),
});