prop_copy() will now keep track of abstract methods
parent
e783713ca7
commit
716db6d086
18
lib/class.js
18
lib/class.js
|
@ -58,10 +58,13 @@ exports.extend = function( base )
|
||||||
*/
|
*/
|
||||||
exports.abstractMethod = function( definition )
|
exports.abstractMethod = function( definition )
|
||||||
{
|
{
|
||||||
return function()
|
var method = function()
|
||||||
{
|
{
|
||||||
throw new Error( "Cannot call abstract method" );
|
throw new Error( "Cannot call abstract method" );
|
||||||
}
|
};
|
||||||
|
|
||||||
|
method.abstractFlag = true;
|
||||||
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,6 +97,11 @@ function prop_copy( props, dest, result_data )
|
||||||
{
|
{
|
||||||
result_data = result_data || {};
|
result_data = result_data || {};
|
||||||
|
|
||||||
|
// initialize result_data
|
||||||
|
result_data = {
|
||||||
|
abstractMethods: [],
|
||||||
|
};
|
||||||
|
|
||||||
// copy each of the properties to the destination object
|
// copy each of the properties to the destination object
|
||||||
for ( property in props )
|
for ( property in props )
|
||||||
{
|
{
|
||||||
|
@ -105,6 +113,12 @@ function prop_copy( props, dest, result_data )
|
||||||
getter = ( ( getset ) ? props.__lookupGetter__( property ) : null ),
|
getter = ( ( getset ) ? props.__lookupGetter__( property ) : null ),
|
||||||
setter = ( ( getset ) ? props.__lookupSetter__( property ) : null );
|
setter = ( ( getset ) ? props.__lookupSetter__( property ) : null );
|
||||||
|
|
||||||
|
// did we find an abstract method?
|
||||||
|
if ( ( prop instanceof Function ) && ( prop.abstractFlag === true ) )
|
||||||
|
{
|
||||||
|
result_data.abstractMethods.push( property );
|
||||||
|
}
|
||||||
|
|
||||||
// check for getter/setter overrides
|
// check for getter/setter overrides
|
||||||
if ( getter || setter )
|
if ( getter || setter )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue