1
0
Fork 0

Abstract methods are now passed to subtypes

closure/master
Mike Gerwitz 2010-11-14 01:18:49 -05:00
parent d3ba8a9dfe
commit d5b4477109
1 changed files with 22 additions and 2 deletions

View File

@ -98,7 +98,7 @@ function prop_copy( props, dest, result_data )
result_data = result_data || {}; result_data = result_data || {};
// initialize result_data // initialize result_data
result_data.abstractMethods = []; result_data.abstractMethods = 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 )
@ -194,7 +194,9 @@ function extend()
}; };
// copy the given properties into the new prototype // copy the given properties into the new prototype
var result_data = {}; var result_data = {
abstractMethods: base.abstractMethods || [],
};
prop_copy( props, prototype, result_data ); prop_copy( props, prototype, result_data );
// reference to the parent prototype (for more experienced users) // reference to the parent prototype (for more experienced users)
@ -246,6 +248,24 @@ function attach_abstract( func, methods )
{ {
return is_abstract; 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,
});
}
} }