From 2e8097e21e1162b83956d2f0d2aee56f2bfc66c7 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Wed, 1 Dec 2010 21:13:51 -0500 Subject: [PATCH] Altered abstract method declaration (using strings to represent arguments rather than a function) --- lib/util.js | 12 +++++++----- test/test-class-abstract.js | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/util.js b/lib/util.js index 301e4a6..7ef5600 100644 --- a/lib/util.js +++ b/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 - * implementations must follow + * @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 diff --git a/test/test-class-abstract.js b/test/test-class-abstract.js index 1785318..96c84f6 100644 --- a/test/test-class-abstract.js +++ b/test/test-class-abstract.js @@ -42,7 +42,7 @@ var AbstractFoo = Class.extend( this.ctorCalled = true; }, - method: abstractMethod( function( one, two, three ){} ), + method: abstractMethod( 'one', 'two', 'three' ), second: abstractMethod(), });