Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Missing yield in generator' should not be an error in JSX #1475

Closed
jeswin opened this issue May 2, 2014 · 4 comments
Closed

'Missing yield in generator' should not be an error in JSX #1475

jeswin opened this issue May 2, 2014 · 4 comments

Comments

@jeswin
Copy link

jeswin commented May 2, 2014

Upgrade to a newer version of esprima-fb removes this error.

As a work around, putting a yield after the return works for now:

function*() {
  return x;
  yield false;
}
@sophiebits
Copy link
Collaborator

Curious -- what's the use case for a generator that never yields?

@jeswin
Copy link
Author

jeswin commented May 2, 2014

The most common example I can think of will be this in koajs

var koa = require('koa');
var app = koa();

app.use(function *(){
  this.body = 'Hello World';
});

app.listen(3000);

Also, methods might take generators as parameters and we might need to pass one that does nothing except return.

@zpao
Copy link
Member

zpao commented May 2, 2014

Updating esprima: facebookarchive/esprima#17, which will make it's way back here eventually

@zpao
Copy link
Member

zpao commented May 2, 2014

I tested that your koa example is transformed with an npm linked fb-esprima

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants