instance-construct-throws.js (958B)
1 // Copyright 2018 Valerie Young. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-asyncgeneratorfunction 6 description: The instance created by AsyncGeneratorFunction is not a constructor 7 info: | 8 AsyncGeneratorFunction ( p1, p2, … , pn, body ) 9 ... 10 3. Return ? CreateDynamicFunction(C, NewTarget, "async generator", args). 11 12 Runtime Semantics: CreateDynamicFunction( constructor, newTarget, kind, args ) 13 ... 14 32. Let F be FunctionAllocate(proto, strict, kind). 15 ... 16 17 FunctionAllocate ( functionPrototype, strict, functionKind ) 18 // [[Construct]] and [[ConstructKind]] are not set for functionKind="async generators" 19 20 features: [async-iteration] 21 ---*/ 22 23 var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor; 24 25 var instance = AsyncGeneratorFunction(); 26 27 assert.throws(TypeError, function() { 28 new instance(); 29 }) 30 31 32 33 reportCompare(0, 0);