Altered abstract method declaration (using strings to represent arguments rather than a function)
parent
837422c46f
commit
2e8097e21e
10
lib/util.js
10
lib/util.js
|
@ -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
|
||||
|
|
|
@ -42,7 +42,7 @@ var AbstractFoo = Class.extend(
|
|||
this.ctorCalled = true;
|
||||
},
|
||||
|
||||
method: abstractMethod( function( one, two, three ){} ),
|
||||
method: abstractMethod( 'one', 'two', 'three' ),
|
||||
|
||||
second: abstractMethod(),
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue