mirror of
https://github.com/flynx/object.js.git
synced 2025-10-29 18:40:08 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
88b3dfddb5
commit
ee05101695
51
object.js
51
object.js
@ -344,6 +344,18 @@ function(obj){
|
|||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// Helper objects/constructors...
|
// Helper objects/constructors...
|
||||||
|
|
||||||
|
// NOTE: these are missing from JavaScript for some reason...
|
||||||
|
//
|
||||||
|
// XXX should these be global???
|
||||||
|
var Generator =
|
||||||
|
module.Generator =
|
||||||
|
(function*(){}).constructor
|
||||||
|
|
||||||
|
var AsyncGenerator =
|
||||||
|
module.AsyncGenerator =
|
||||||
|
(async function*(){}).constructor
|
||||||
|
|
||||||
|
|
||||||
BOOTSTRAP(function(){
|
BOOTSTRAP(function(){
|
||||||
|
|
||||||
// Error with some JS quirks fixed...
|
// Error with some JS quirks fixed...
|
||||||
@ -365,13 +377,6 @@ BOOTSTRAP(function(){
|
|||||||
//return Reflect.construct(Error, args, this.constructor) },
|
//return Reflect.construct(Error, args, this.constructor) },
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
|
||||||
// Prototype chain content access...
|
|
||||||
|
|
||||||
BOOTSTRAP(function(){
|
|
||||||
|
|
||||||
// Value trigger iteration stop and to carry results...
|
// Value trigger iteration stop and to carry results...
|
||||||
//
|
//
|
||||||
@ -385,18 +390,6 @@ BOOTSTRAP(function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// XXX should this be global???
|
|
||||||
var Generator =
|
|
||||||
module.Generator =
|
|
||||||
(function*(){}).constructor
|
|
||||||
|
|
||||||
|
|
||||||
// XXX should this be global???
|
|
||||||
var AsyncGenerator =
|
|
||||||
module.AsyncGenerator =
|
|
||||||
(async function*(){}).constructor
|
|
||||||
|
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
var stoppable =
|
var stoppable =
|
||||||
module.stoppable =
|
module.stoppable =
|
||||||
@ -408,9 +401,6 @@ function(func){
|
|||||||
// in sync...
|
// in sync...
|
||||||
function*(){
|
function*(){
|
||||||
try{
|
try{
|
||||||
/* XXX should we return STOP???
|
|
||||||
yield* func.call(this, ...arguments)
|
|
||||||
/*/
|
|
||||||
for(var res of func.call(this, ...arguments)){
|
for(var res of func.call(this, ...arguments)){
|
||||||
if(res === STOP){
|
if(res === STOP){
|
||||||
return }
|
return }
|
||||||
@ -418,7 +408,6 @@ function(func){
|
|||||||
yield res.value
|
yield res.value
|
||||||
return }
|
return }
|
||||||
yield res }
|
yield res }
|
||||||
//*/
|
|
||||||
} catch(err){
|
} catch(err){
|
||||||
if(err === STOP){
|
if(err === STOP){
|
||||||
return
|
return
|
||||||
@ -432,9 +421,6 @@ function(func){
|
|||||||
// in sync...
|
// in sync...
|
||||||
async function*(){
|
async function*(){
|
||||||
try{
|
try{
|
||||||
/* XXX should we return STOP???
|
|
||||||
yield* func.call(this, ...arguments)
|
|
||||||
/*/
|
|
||||||
for(var res of func.call(this, ...arguments)){
|
for(var res of func.call(this, ...arguments)){
|
||||||
if(res === STOP){
|
if(res === STOP){
|
||||||
return }
|
return }
|
||||||
@ -442,7 +428,6 @@ function(func){
|
|||||||
yield res.value
|
yield res.value
|
||||||
return }
|
return }
|
||||||
yield res }
|
yield res }
|
||||||
//*/
|
|
||||||
} catch(err){
|
} catch(err){
|
||||||
if(err === STOP){
|
if(err === STOP){
|
||||||
return
|
return
|
||||||
@ -452,16 +437,13 @@ function(func){
|
|||||||
throw err } }
|
throw err } }
|
||||||
: function(){
|
: function(){
|
||||||
try{
|
try{
|
||||||
/* XXX should we return STOP???
|
|
||||||
return func.call(this, ...arguments)
|
|
||||||
/*/
|
|
||||||
var res = func.call(this, ...arguments)
|
var res = func.call(this, ...arguments)
|
||||||
|
// NOTE: this is here for uniformity...
|
||||||
if(res === STOP){
|
if(res === STOP){
|
||||||
return }
|
return }
|
||||||
if(res instanceof STOP){
|
if(res instanceof STOP){
|
||||||
return res.value }
|
return res.value }
|
||||||
return res
|
return res
|
||||||
//*/
|
|
||||||
} catch(err){
|
} catch(err){
|
||||||
if(err === STOP){
|
if(err === STOP){
|
||||||
return
|
return
|
||||||
@ -472,6 +454,11 @@ function(func){
|
|||||||
return func.toString() }, }) }
|
return func.toString() }, }) }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// Prototype chain content access...
|
||||||
|
|
||||||
|
|
||||||
// Get a list of source objects for a prop/attr name...
|
// Get a list of source objects for a prop/attr name...
|
||||||
//
|
//
|
||||||
// sources(obj, name)
|
// sources(obj, name)
|
||||||
@ -1596,4 +1583,4 @@ BOOTSTRAP()
|
|||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* vim:set ts=4 sw=4 : */ return module })
|
* vim:set ts=4 sw=4 nowrap : */ return module })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user