.next('yo') in newborn generators

David Bruant bruant.d at gmail.com
Wed Jan 15 08:32:06 PST 2014


Playing with the test cases of the regenerator project [1], I came 
across a case and was wondering what the intention of the spec is given 
that Firefox and Chrome recent implementations diverge.
Apologies for not reading all the previous discussions on this edge case.

Test case:
function *gen(x) {
     yield x;

var g = gen('whatever');

Chrome & regenerator:
{value: "whatever", done: false}

Firefox (Aurora 28):
TypeError: attempt to send 0 to newborn generator

 From what I understand, the spec says an error should be thrown because 
the generator is in "suspendedStart" state and value is not undefined 
( GeneratorResume step 7).
Where do I file bugs?


[1] https://github.com/facebook/regenerator/blob/master/test/tests.es6.js

More information about the es-discuss mailing list