diff --git a/lib/class.js b/lib/class.js index 0edaf05..1dca210 100644 --- a/lib/class.js +++ b/lib/class.js @@ -98,7 +98,7 @@ function prop_copy( props, dest, result_data ) result_data = result_data || {}; // initialize result_data - result_data.abstractMethods = []; + result_data.abstractMethods = result_data.abstractMethods || []; // copy each of the properties to the destination object for ( property in props ) @@ -194,7 +194,9 @@ function extend() }; // copy the given properties into the new prototype - var result_data = {}; + var result_data = { + abstractMethods: base.abstractMethods || [], + }; prop_copy( props, prototype, result_data ); // reference to the parent prototype (for more experienced users) @@ -246,6 +248,24 @@ function attach_abstract( func, methods ) { return is_abstract; }; + + + // attach the list of abstract methods to the class + if ( Object.defineProperty === undefined ) + { + func.abstractMethods = methods; + } + else + { + Object.defineProperty( func, 'abstractMethods', + { + value: methods, + + enumerable: false, + writable: false, + configurable: false, + }); + } }