Index: src/generator.js |
diff --git a/src/generator.js b/src/generator.js |
index 5e61091565567bf9d516a45d0efd72add6aa33af..a65aae4fc164726e55fe2ed82643a490f2960a0f 100644 |
--- a/src/generator.js |
+++ b/src/generator.js |
@@ -65,6 +65,17 @@ function GeneratorObjectThrow(exn) { |
return %_GeneratorThrow(this, exn); |
} |
+function GeneratorFunctionPrototypeConstructor(x) { |
+ if (%_IsConstructCall()) { |
+ throw MakeTypeError('not_constructor', ['GeneratorFunctionPrototype']); |
+ } |
+} |
+ |
+function GeneratorFunctionConstructor(arg1) { // length == 1 |
+ return NewFunction(arguments, 'function*'); |
+} |
+ |
+ |
function SetUpGenerators() { |
%CheckIsBootstrapping(); |
var GeneratorObjectPrototype = GeneratorFunctionPrototype.prototype; |
@@ -76,9 +87,11 @@ function SetUpGenerators() { |
%SetProperty(GeneratorObjectPrototype, "constructor", |
GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY); |
%SetPrototype(GeneratorFunctionPrototype, $Function.prototype); |
+ %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor); |
%SetProperty(GeneratorFunctionPrototype, "constructor", |
GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY); |
%SetPrototype(GeneratorFunction, $Function); |
+ %SetCode(GeneratorFunction, GeneratorFunctionConstructor); |
} |
SetUpGenerators(); |