1
0
Fork 0

Abstract map no longer passed to method_override() - it's only used in that method

closure/master
Mike Gerwitz 2010-12-18 10:57:00 -05:00
parent e39cfea741
commit 2789e5fcf9
1 changed files with 11 additions and 12 deletions

View File

@ -212,15 +212,7 @@ exports.propCopy = function( props, dest, result_data, actions )
var abstract_methods = var abstract_methods =
result_data.abstractMethods = result_data.abstractMethods || []; result_data.abstractMethods = result_data.abstractMethods || [];
// it's much faster to lookup a hash than it is to iterate through an entire var abstract_regen = false;
// array each time we need to find an existing abstract method
var abstract_map = {},
abstract_regen = false;
for ( var i = 0, len = abstract_methods.length; i < len; i++ )
{
var method = abstract_methods[ i ];
abstract_map[ method ] = i;
}
var use_or = function( use, or ) var use_or = function( use, or )
{ {
@ -277,7 +269,6 @@ exports.propCopy = function( props, dest, result_data, actions )
pre, pre,
func, func,
name, name,
abstract_map,
abstract_methods, abstract_methods,
data data
); );
@ -371,16 +362,24 @@ exports.isAbstractMethod = function( func )
* @param {Function} super_method method to override * @param {Function} super_method method to override
* @param {Function} new_method method to override with * @param {Function} new_method method to override with
* @param {string} name method name * @param {string} name method name
* @param {Object} abstract_map lookup table for abstract methods
* @param {Array} abstract_methods list of abstract methods * @param {Array} abstract_methods list of abstract methods
* @param {Object} data object in which to store result data * @param {Object} data object in which to store result data
* *
* @return {Function} overridden method * @return {Function} overridden method
*/ */
function method_override( function method_override(
super_method, new_method, name, abstract_map, abstract_methods, data super_method, new_method, name, abstract_methods, data
) )
{ {
// it's much faster to lookup a hash than it is to iterate through an entire
// array each time we need to find an existing abstract method
var abstract_map = {};
for ( var i = 0, len = abstract_methods.length; i < len; i++ )
{
var method = abstract_methods[ i ];
abstract_map[ method ] = i;
}
if ( abstract_map[ name ] !== undefined ) if ( abstract_map[ name ] !== undefined )
{ {
var is_abstract = exports.isAbstractMethod( new_method ); var is_abstract = exports.isAbstractMethod( new_method );