mirror of
https://github.com/flynx/types.js.git
synced 2025-12-19 01:41:38 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
73a33e4ff9
commit
8d882408d2
23
generator.js
23
generator.js
@ -38,11 +38,11 @@ module.STOP =
|
||||
// of each of them.
|
||||
// So, below we will define:
|
||||
//
|
||||
// GeneratorPrototype
|
||||
// Generator.prototype
|
||||
// prototype of the generator constructors (i.e. Iter(..) from the
|
||||
// above example)
|
||||
//
|
||||
// GeneratorPrototype.prototype
|
||||
// Generator.prototype.prototype
|
||||
// generator instance prototype (i.e. iter for the above code)
|
||||
//
|
||||
//
|
||||
@ -58,17 +58,10 @@ module.STOP =
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
var GeneratorPrototype =
|
||||
(function*(){}).constructor.prototype
|
||||
|
||||
var Generator =
|
||||
module.Generator =
|
||||
(function*(){}).constructor
|
||||
|
||||
|
||||
var AsyncGeneratorPrototype =
|
||||
(async function*(){}).constructor.prototype
|
||||
|
||||
var AsyncGenerator =
|
||||
module.AsyncGenerator =
|
||||
(async function*(){}).constructor
|
||||
@ -165,12 +158,12 @@ Generator.iter =
|
||||
|
||||
// NOTE: we need .iter(..) to both return generators if passed an iterable
|
||||
// and genereator constructos if passed a function...
|
||||
iter.__proto__ = GeneratorPrototype
|
||||
iter.__proto__ = Generator.prototype
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// GeneratorPrototype "class" methods...
|
||||
// Generator.prototype "class" methods...
|
||||
//
|
||||
// the following are effectively the same:
|
||||
// 1) Wrapper
|
||||
@ -506,8 +499,8 @@ object.Mixin('GeneratorProtoMixin', 'soft', {
|
||||
})
|
||||
|
||||
|
||||
GeneratorMixin(GeneratorPrototype)
|
||||
GeneratorProtoMixin(GeneratorPrototype.prototype)
|
||||
GeneratorMixin(Generator.prototype)
|
||||
GeneratorProtoMixin(Generator.prototype.prototype)
|
||||
|
||||
|
||||
// Extend base iterators...
|
||||
@ -613,8 +606,8 @@ object.Mixin('AsyncGeneratorProtoMixin', 'soft', {
|
||||
// ...
|
||||
})
|
||||
|
||||
AsyncGeneratorMixin(AsyncGeneratorPrototype)
|
||||
AsyncGeneratorProtoMixin(AsyncGeneratorPrototype.prototype)
|
||||
AsyncGeneratorMixin(AsyncGenerator.prototype)
|
||||
AsyncGeneratorProtoMixin(AsyncGenerator.prototype.prototype)
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user