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