diff --git a/lib/class.js b/lib/class.js index 1d3bf20..04e8048 100644 --- a/lib/class.js +++ b/lib/class.js @@ -58,10 +58,13 @@ exports.extend = function( base ) */ exports.abstractMethod = function( definition ) { - return function() + var method = function() { 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 || {}; + // initialize result_data + result_data = { + abstractMethods: [], + }; + // copy each of the properties to the destination object for ( property in props ) { @@ -105,6 +113,12 @@ function prop_copy( props, dest, result_data ) getter = ( ( getset ) ? props.__lookupGetter__( 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 if ( getter || setter ) {