2017-03-15 22:12:54 +01:00
|
|
|
// Copyright 2017 the V8 project authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
|
|
|
esid: sec-generatorfunction
|
|
|
|
description: The instance created by GeneratorFunction is not a constructor
|
|
|
|
info: |
|
|
|
|
25.2.1.1 GeneratorFunction ( p1, p2, … , pn, body )
|
|
|
|
|
|
|
|
...
|
|
|
|
3. Return ? CreateDynamicFunction(C, NewTarget, "generator", args).
|
|
|
|
|
|
|
|
19.2.1.1.1 Runtime Semantics: CreateDynamicFunction( constructor, newTarget, kind, args )
|
|
|
|
|
|
|
|
...
|
|
|
|
34. If kind is "generator", then
|
|
|
|
a. Let prototype be ObjectCreate(%GeneratorPrototype%).
|
|
|
|
b. Perform DefinePropertyOrThrow(F, "prototype", PropertyDescriptor{[[Value]]: prototype,
|
|
|
|
[[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}).
|
|
|
|
...
|
2017-10-04 22:12:34 +02:00
|
|
|
features: [generators]
|
2017-03-15 22:12:54 +01:00
|
|
|
---*/
|
|
|
|
|
2018-02-15 21:25:56 +01:00
|
|
|
var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor;
|
2017-03-15 22:12:54 +01:00
|
|
|
|
|
|
|
var instance = GeneratorFunction();
|
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
2018-02-15 21:25:56 +01:00
|
|
|
new instance();
|
2017-03-15 22:12:54 +01:00
|
|
|
})
|