From e789e5800074f501c33e356e1179de294cfb2899 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 27 Dec 2010 22:11:37 -0500 Subject: [PATCH] Removed Class.abstractMethod in favor of property keyword --- lib/class.js | 3 --- lib/util.js | 17 +++++++++++++---- test/test-class-abstract.js | 8 ++++---- 3 files changed, 17 insertions(+), 11 deletions(-) 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