diff --git a/lib/class.js b/lib/class.js index 3c61fbf..4f426a8 100644 --- a/lib/class.js +++ b/lib/class.js @@ -39,9 +39,6 @@ exports.extend = function( base ) } -exports.abstractMethod = util.createAbstractMethod; - - /** * Default class implementation * diff --git a/lib/util.js b/lib/util.js index 0fa2e51..797e6ec 100644 --- a/lib/util.js +++ b/lib/util.js @@ -191,6 +191,18 @@ exports.propParse = function( data, options ) callback_each.call( callback_each, name, value ); } + if ( keywords['abstract'] ) + { + if ( value instanceof Array ) + { + value = exports.createAbstractMethod.apply( this, value ); + } + else + { + value = exports.createAbstractMethod(); + } + } + // getter/setter if ( getter || setter ) { @@ -204,10 +216,7 @@ exports.propParse = function( data, options ) callback_method, name, value, - ( ( keywords['abstract'] ) - ? true - : exports.isAbstractMethod( value ) - ) + exports.isAbstractMethod( value ) ); } // simple property diff --git a/test/test-class-abstract.js b/test/test-class-abstract.js index b8eb4ce..3344ad5 100644 --- a/test/test-class-abstract.js +++ b/test/test-class-abstract.js @@ -22,10 +22,10 @@ * @package test */ -var common = require( './common' ), +var common = require( './common' ), assert = require( 'assert' ), Class = common.require( 'class' ), - abstractMethod = common.require( 'class' ).abstractMethod, + abstractMethod = common.require( 'util' ).createAbstractMethod, util = common.require( 'util' ); // not abstract @@ -41,9 +41,9 @@ var AbstractFoo = Class.extend( this.ctorCalled = true; }, - method: abstractMethod( 'one', 'two', 'three' ), + 'abstract method': [ 'one', 'two', 'three' ], - second: abstractMethod(), + 'abstract second': [], }); // still abstract (didn't provide a concrete implementation of both abstract