mirror of
https://github.com/flynx/object.js.git
synced 2025-10-30 02:50:10 +00:00
notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9d919187a5
commit
8a18714798
24
object.js
24
object.js
@ -890,23 +890,27 @@ function Constructor(name, a, b, c){
|
|||||||
&& obj.__init__(...arguments)
|
&& obj.__init__(...arguments)
|
||||||
return obj }
|
return obj }
|
||||||
|
|
||||||
// XXX this changes the name but does not seem to affect the displayed
|
// constructor naming...
|
||||||
// doc in chrome...
|
// NOTE: we are not using:
|
||||||
// FF does not seem to be affected by either version of code...
|
// Object.defineProperty(_constructor, 'name', { value: name })
|
||||||
//Object.defineProperty(_constructor, 'name', { value: name })
|
// because this does not affect the name displayed by the Chrome
|
||||||
|
// DevTools. FF does not seem to care about either version of code...
|
||||||
_constructor.name = name
|
_constructor.name = name
|
||||||
// just in case the browser/node refuses to change the name, we'll make
|
// just in case the browser/node refuses to change the name, we'll make
|
||||||
// it a different offer ;)
|
// them a different offer ;)
|
||||||
|
// NOTE: this eval(..) should not be a risk as its inputs are
|
||||||
|
// static and never infuenced by external inputs...
|
||||||
|
// NOTE: this will fail with non-identifier names...
|
||||||
_constructor.name == 'Constructor'
|
_constructor.name == 'Constructor'
|
||||||
// NOTE: this eval(..) should not be a risk as its inputs are
|
|
||||||
// static and never infuenced by external inputs...
|
|
||||||
// NOTE: this will fail with non-identifier names...
|
|
||||||
&& eval('_constructor = '+ _constructor
|
&& eval('_constructor = '+ _constructor
|
||||||
.toString()
|
.toString()
|
||||||
.replace(/Constructor/g, name))
|
.replace(/Constructor/g, name))
|
||||||
// set .toString(..)...
|
// set .toString(..)...
|
||||||
// NOTE: do this only if .toString(..) is not defined by user...
|
// NOTE: this test is here to enable mixinFlat(..) to overwrite
|
||||||
// XXX revise this test...
|
// .toString(..) below...
|
||||||
|
// XXX not sure if this is the correct approach...
|
||||||
|
// XXX might be a good idea to create a common base class and
|
||||||
|
// keep this there...
|
||||||
;((constructor_mixin || {}).toString === Function.prototype.toString
|
;((constructor_mixin || {}).toString === Function.prototype.toString
|
||||||
|| (constructor_mixin || {}).toString === Object.prototype.toString)
|
|| (constructor_mixin || {}).toString === Object.prototype.toString)
|
||||||
&& Object.defineProperty(_constructor, 'toString', {
|
&& Object.defineProperty(_constructor, 'toString', {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user