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