invoked-as-function-no-arguments.js 623 B

123456789101112131415161718
  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 function invocation pattern without arguments, the
  7. GeneratorFunction intrinsic returns a valid generator with an empty body.
  8. features: [generators]
  9. ---*/
  10. var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor;
  11. var g = GeneratorFunction();
  12. var iter = g();
  13. var result = iter.next();
  14. assert.sameValue(result.value, undefined, 'Result `value`');
  15. assert.sameValue(result.done, true, 'Result `done` flag');