remove useless GeneratorFunction aliasing causing issues #283
This commit is contained in:
parent
0ee4a15d01
commit
c92fd6f0bb
@ -27,20 +27,14 @@ var ContinueSentinel = {};
|
|||||||
|
|
||||||
// Dummy constructor that we use as the .constructor property for
|
// Dummy constructor that we use as the .constructor property for
|
||||||
// functions that return Generator objects.
|
// functions that return Generator objects.
|
||||||
var GF = function GeneratorFunction() {};
|
function GeneratorFunction() {}
|
||||||
var GFp = function GeneratorFunctionPrototype() {};
|
var GFp = function GeneratorFunctionPrototype() {};
|
||||||
var Gp = GFp.prototype = Generator.prototype;
|
var Gp = GFp.prototype = Generator.prototype;
|
||||||
(GFp.constructor = GF).prototype =
|
(GFp.constructor = GeneratorFunction).prototype = Gp.constructor = GFp;
|
||||||
Gp.constructor = GFp;
|
|
||||||
|
|
||||||
// Ensure isGeneratorFunction works when Function#name not supported.
|
|
||||||
var GFName = "GeneratorFunction";
|
|
||||||
if (GF.name !== GFName) GF.name = GFName;
|
|
||||||
if (GF.name !== GFName) throw new Error(GFName + " renamed?");
|
|
||||||
|
|
||||||
runtime.isGeneratorFunction = function (genFun) {
|
runtime.isGeneratorFunction = function (genFun) {
|
||||||
var ctor = genFun && genFun.constructor;
|
var ctor = genFun && genFun.constructor;
|
||||||
return ctor ? GF.name === ctor.name : false;
|
return ctor ? GeneratorFunction.name === ctor.name : false;
|
||||||
};
|
};
|
||||||
|
|
||||||
runtime.mark = function (genFun) {
|
runtime.mark = function (genFun) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user