1
0
Fork 0

Combined shared conditions in separate if statements

closure/master
Mike Gerwitz 2011-01-24 23:30:32 -05:00
parent eba32ed4cb
commit cd7b2563e5
1 changed files with 18 additions and 15 deletions

View File

@ -66,8 +66,10 @@ exports.buildMethod = function( members, meta, name, value, keywords )
{ {
var prev = scanMembers( members, name ); var prev = scanMembers( members, name );
if ( prev )
{
// disallow overriding properties with methods // disallow overriding properties with methods
if ( prev && !( prev instanceof Function ) ) if ( !( prev instanceof Function ) )
{ {
throw new TypeError( throw new TypeError(
"Cannot override property '" + name + "' with method" "Cannot override property '" + name + "' with method"
@ -75,15 +77,16 @@ exports.buildMethod = function( members, meta, name, value, keywords )
} }
// ensure parameter list is at least the length of its supertype // ensure parameter list is at least the length of its supertype
if ( prev && ( if ( ( value.__length || value.length )
( value.__length || value.length ) < ( prev.__length || prev.length ) < ( prev.__length || prev.length )
) ) )
{ {
throw new TypeError( throw new TypeError(
"Declaration of method '" + name + "' must be compatiable " + "Declaration of method '" + name + "' must be compatiable " +
"with that of its supertype" "with that of its supertype"
); );
} }
}
var dest = getMemberVisibility( members, keywords ); var dest = getMemberVisibility( members, keywords );