tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-12-29 03:24:38 +03:00
parent 3bfd570662
commit 664cd96908
2 changed files with 12 additions and 11 deletions

View File

@ -274,10 +274,19 @@ BOOTSTRAP(function(){
// Error with some JS quirks fixed... // Error with some JS quirks fixed...
// //
// XXX EXPERIMENTAL
module.Error = module.Error =
Constructor('Error', Error, { Constructor('Error', Error, {
get name(){ get name(){
return this.constructor.name }, return this.constructor.name },
// XXX BUG? is this an error that with this everything seems to work
// while without this instances of this work fine while instances
// of "sub-classes" do not set the .stack correctly???
// ...is this a JS quirk or am I missing something???
__new__: function(context, ...args){
return Reflect.construct(module.Error.__proto__, args, this.constructor) },
//return Reflect.construct(Error, args, this.constructor) },
}) })
}) })
@ -286,18 +295,10 @@ BOOTSTRAP(function(){
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// Prototype chain content access... // Prototype chain content access...
// Value trigger iteration stop and to carry results...
//
// NOTE: we need Constructor(..) to make this so will deffer this to the
// end...
//
// XXX should we unify this and how types.js/Array does things with
// StopTteration???
// ...I'm not sure I like the StopIteration approach as adding a
// try/catch block and rethrowing excptions masks their origin and
// context and makes things harder when tracking down errors...
BOOTSTRAP(function(){ BOOTSTRAP(function(){
// Value trigger iteration stop and to carry results...
//
module.STOP = module.STOP =
Constructor('STOP', { Constructor('STOP', {
doc: 'stop iteration.', doc: 'stop iteration.',

View File

@ -1,6 +1,6 @@
{ {
"name": "ig-object", "name": "ig-object",
"version": "5.4.14", "version": "5.4.15",
"description": "", "description": "",
"main": "object.js", "main": "object.js",
"scripts": { "scripts": {