Removed Class.abstractMethod in favor of property keyword
parent
f705f38640
commit
e789e58000
|
@ -39,9 +39,6 @@ exports.extend = function( base )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.abstractMethod = util.createAbstractMethod;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default class implementation
|
* Default class implementation
|
||||||
*
|
*
|
||||||
|
|
17
lib/util.js
17
lib/util.js
|
@ -191,6 +191,18 @@ exports.propParse = function( data, options )
|
||||||
callback_each.call( callback_each, name, value );
|
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
|
// getter/setter
|
||||||
if ( getter || setter )
|
if ( getter || setter )
|
||||||
{
|
{
|
||||||
|
@ -204,10 +216,7 @@ exports.propParse = function( data, options )
|
||||||
callback_method,
|
callback_method,
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
( ( keywords['abstract'] )
|
exports.isAbstractMethod( value )
|
||||||
? true
|
|
||||||
: exports.isAbstractMethod( value )
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// simple property
|
// simple property
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
var common = require( './common' ),
|
var common = require( './common' ),
|
||||||
assert = require( 'assert' ),
|
assert = require( 'assert' ),
|
||||||
Class = common.require( 'class' ),
|
Class = common.require( 'class' ),
|
||||||
abstractMethod = common.require( 'class' ).abstractMethod,
|
abstractMethod = common.require( 'util' ).createAbstractMethod,
|
||||||
util = common.require( 'util' );
|
util = common.require( 'util' );
|
||||||
|
|
||||||
// not abstract
|
// not abstract
|
||||||
|
@ -41,9 +41,9 @@ var AbstractFoo = Class.extend(
|
||||||
this.ctorCalled = true;
|
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
|
// still abstract (didn't provide a concrete implementation of both abstract
|
||||||
|
|
Loading…
Reference in New Issue