diff --git a/object.js b/object.js index d01e812..c845fe8 100755 --- a/object.js +++ b/object.js @@ -382,9 +382,9 @@ function(context, constructor, ...args){ return constructor.prototype.__call__ .call(obj, this, ...arguments) }, constructor.prototype.__call__) - // use parent's constructor... // XXX EXPERIMENTAL... // XXX do a better test... + // use parent's constructor... : (constructor.__proto__ instanceof Function && constructor.__proto__ !== (function(){}).__proto__) ? Reflect.construct(constructor.__proto__, [], constructor) @@ -528,6 +528,8 @@ function(context, constructor, ...args){ // clone it via. Object.create(..) or copy it... // NOTE: to disable .__rawinstance__(..) handling set it to false in the // class prototype... +// +// XXX revise .toString(..) definition test... var Constructor = module.Constructor = // shorthand... @@ -559,7 +561,7 @@ function Constructor(name, a, b){ .replace(/Constructor/g, name)) // set .toString(..)... // NOTE: do this only if .toString(..) is not defined by user... - // XXX revise this... + // XXX revise this test... ;((cls_proto || {}).toString === Function.toString || (cls_proto || {}).toString === ({}).toString) && Object.defineProperty(_constructor, 'toString', { @@ -578,7 +580,9 @@ function Constructor(name, a, b){ return `${this.name}(${args})${normalizeIndent(code)}` }, enumerable: false, }) - _constructor.__proto__ = cls_proto + _constructor.__proto__ = cls_proto === undefined ? + _constructor.__proto__ + : cls_proto _constructor.prototype = proto // generic raw instance constructor... _constructor.__rawinstance__ instanceof Function diff --git a/package.json b/package.json index c999356..eb49472 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-object", - "version": "2.7.0", + "version": "2.7.1", "description": "", "main": "object.js", "scripts": {