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
yield* is not properly captured inside of expressions #151
Comments
What do you expect? |
|
need to do more research on this. spec BNF is confusing me. this looks like it should tokenize as:
|
Here's the best I can do for a minimized testcase: function* a() {
return 1 + yield* f();
} which transforms to var a = regeneratorRuntime.mark(function a() {
return regeneratorRuntime.wrap(function a$(context$1$0) {
while (1) switch (context$1$0.prev = context$1$0.next) {
case 0:
return context$1$0.abrupt("return", 1 + yield* f());
case 1:
case "end":
return context$1$0.stop();
}
}, a, this);
}); which is obviously wrong because the |
Oh wow, Esprima is parsing |
inside generators yield is a reserved word so this is def not correct On Tue, Dec 9, 2014 at 11:38 AM, Ben Newman notifications@github.com
|
V8 pukes as well:
|
Although, maybe that should fail anyway (just perhaps with a different error message). Due to operator precedence, wouldn't:
...be equivalent to:
|
Notably It seems like either the spec or V8 is disallowing |
Oops, I think operator precedence would actually make it equivalent to:
|
To clarify: by "arguably correct" I just meant the output from Regenerator is correct given the input from the parser, which definitely disagrees with V8 and the spec. |
I think validity would depend if |
The You may need to recognize them as two tokens in you lexer, but then combining into a single token for parsing the expression. Of course this is all context sensitive and only applies generator function: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-assignment-operators |
@allenwb so it sounds like |
@domenic no, because
|
Hmm I see. It feels strange then that |
For the record, #151 seems not to be a bug, and the parentheses around the yield* expression are mandatory.
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed. |
The following code does not transform as expected:
The text was updated successfully, but these errors were encountered: