diff --git a/lib/util.js b/lib/util.js index 6f09dd2..f8049ad 100644 --- a/lib/util.js +++ b/lib/util.js @@ -228,7 +228,9 @@ exports.propCopy = function( props, dest, result_data ) } else { - // todo: attempted override of property with method + throw new Error( + "Cannot override property '" + name + "' with method" + ); } if ( data.abstractModified ) diff --git a/test/test-class-extend.js b/test/test-class-extend.js index e716c0d..7a84f75 100644 --- a/test/test-class-extend.js +++ b/test/test-class-extend.js @@ -126,3 +126,12 @@ assert.notEqual( "Subtype should contain extended members" ); + +assert.throws( function() +{ + Class.extend( OtherClass, + { + foo: function() {}, + }); +}, Error, "Cannot override property with a method" ); +