diff options
-rwxr-xr-x | src/embind/embind.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js index 71da1108..742dbb94 100755 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -769,6 +769,9 @@ function __embind_register_class( registeredClass.pointeeType = type; type.constructor = createNamedFunction(type.name, function() { + if (Object.getPrototypeOf(this) !== Handle.prototype) { + throw new BindingError("Use 'new' to construct " + name); + } var body = type.constructor.body; return body.apply(this, arguments); }); |