Combined shared conditions in separate if statements
parent
eba32ed4cb
commit
cd7b2563e5
|
@ -66,8 +66,10 @@ exports.buildMethod = function( members, meta, name, value, keywords )
|
|||
{
|
||||
var prev = scanMembers( members, name );
|
||||
|
||||
if ( prev )
|
||||
{
|
||||
// disallow overriding properties with methods
|
||||
if ( prev && !( prev instanceof Function ) )
|
||||
if ( !( prev instanceof Function ) )
|
||||
{
|
||||
throw new TypeError(
|
||||
"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
|
||||
if ( prev && (
|
||||
( value.__length || value.length ) < ( prev.__length || prev.length )
|
||||
) )
|
||||
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 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue