invoked-as-constructor-no-arguments.js (652B)
1 // Copyright (C) 2013 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 25.2 5 description: > 6 When invoked via the constructor invocation pattern without arguments, the 7 GeneratorFunction intrinsic returns a valid generator with an empty body. 8 features: [generators] 9 ---*/ 10 11 var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; 12 13 var g = new GeneratorFunction(); 14 var iter = g(); 15 var result = iter.next(); 16 17 assert.sameValue(result.value, undefined, 'Result `value`'); 18 assert.sameValue(result.done, true, 'Result `done` flag'); 19 20 reportCompare(0, 0);