Proposal: Generator returning a value should throw SyntaxError

Brandon Benvie bbenvie at mozilla.com
Thu Sep 26 22:46:16 PDT 2013


On 9/26/2013 10:40 PM, Brandon Benvie wrote:
> ```js
> function* foo() {
>   yield 'what';
>   yield 'ever';
>   return "DONE";
> }
>
> function* bar() {
>   console.log(yield* foo());
> }
> ```

Err, this logs "DONE" when you do:

```js
var gen = bar();
gen.next();
gen.next();
gen.next();
```
but you got the idea...


More information about the es-discuss mailing list