diff --git a/lib/util.js b/lib/util.js index 6bbd593..eb6b3b2 100644 --- a/lib/util.js +++ b/lib/util.js @@ -206,6 +206,17 @@ exports.propCopy = function( props, dest, result_data ) // default functionality var actions = { + each: function( name, value ) + { + // methods can only be overridden with methods + if ( ( dest[ name ] instanceof Function ) + && ( !( value instanceof Function ) ) + ) + { + throw new TypeError( "Cannot override method with non-method" ); + } + }, + property: function( name, value ) { dest[ name ] = value; @@ -338,12 +349,6 @@ function method_override( super_method, new_method, name, abstract_map, abstract_methods, data ) { - // ensure we're overriding the method with another method - if ( !( new_method instanceof Function ) ) - { - throw new TypeError( "Cannot override method with non-method" ); - } - if ( abstract_map[ name ] !== undefined ) { var is_abstract = exports.isAbstractMethod( new_method );