remove useless GeneratorFunction aliasing causing issues #283

This commit is contained in:
Sebastian McKenzie 2014-12-12 12:14:24 +11:00
parent 0ee4a15d01
commit c92fd6f0bb

View File

@ -27,20 +27,14 @@ var ContinueSentinel = {};
// Dummy constructor that we use as the .constructor property for
// functions that return Generator objects.
var GF = function GeneratorFunction() {};
function GeneratorFunction() {}
var GFp = function GeneratorFunctionPrototype() {};
var Gp = GFp.prototype = Generator.prototype;
(GFp.constructor = GF).prototype =
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?");
(GFp.constructor = GeneratorFunction).prototype = Gp.constructor = GFp;
runtime.isGeneratorFunction = function (genFun) {
var ctor = genFun && genFun.constructor;
return ctor ? GF.name === ctor.name : false;
return ctor ? GeneratorFunction.name === ctor.name : false;
};
runtime.mark = function (genFun) {