Skip to content

Commit

Permalink
remove useless GeneratorFunction aliasing causing issues #283
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmck committed Dec 13, 2014
1 parent 0ee4a15 commit c92fd6f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/6to5/transformation/transformers/es6-generators/runtime.js
Expand Up @@ -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) {
Expand Down

0 comments on commit c92fd6f

Please sign in to comment.