1
0
Fork 0

Ensured properties cannot be overridden with methods

closure/master
Mike Gerwitz 2010-12-07 20:24:51 -05:00
parent 459335cf62
commit 25dc7e031e
2 changed files with 12 additions and 1 deletions

View File

@ -228,7 +228,9 @@ exports.propCopy = function( props, dest, result_data )
} }
else else
{ {
// todo: attempted override of property with method throw new Error(
"Cannot override property '" + name + "' with method"
);
} }
if ( data.abstractModified ) if ( data.abstractModified )

View File

@ -126,3 +126,12 @@ assert.notEqual(
"Subtype should contain extended members" "Subtype should contain extended members"
); );
assert.throws( function()
{
Class.extend( OtherClass,
{
foo: function() {},
});
}, Error, "Cannot override property with a method" );