1
0
Fork 0

prop_copy() will now keep track of abstract methods

closure/master
Mike Gerwitz 2010-11-14 01:02:57 -05:00
parent e783713ca7
commit 716db6d086
1 changed files with 16 additions and 2 deletions

View File

@ -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 )
{ {