-
Notifications
You must be signed in to change notification settings - Fork 786
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
Generator #1178
Generator #1178
Conversation
Now that I'm thinking about it again, I think it should be |
FWIW: I find Going further, Of the names I can think of, |
Seems like a good discussion to move to the ESTree repo for resolution :) |
@@ -3616,6 +3692,10 @@ | |||
startToken = lookahead; | |||
token = lookahead; | |||
|
|||
if (matchKeyword('yield')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we allow yield
to be an identifier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we allow yield to be an identifier?
Probably not. Is there any potential compatibility issue, e.g. old code using yield
as variable name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec outlines the rules for it, but yield is a contextual keyword/identifier. Basically, anywhere inside a generator it's a keyword, and I think also if it's in an arrow inside a generator (on my phone now but would have to confirm in the spec).
Also beware of 'yield' context in function params space:
https://twitter.com/bterlson/status/603016789379846144
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec outlines the rules for it, but yield is a contextual keyword/identifier.
OK, let's continue at #1186 so that it is not buried/forgotten easily.
Until V8 has a specific message of the illegal use of yield, we stick with the generic one. Refs jquery#1033
Since there seems to be no objection, I'm going to land this soon. |
This supercedes #1158. The original code from @dhe128 has been rebased onto the latest master and I've added a few tweaks based on the review from @jeffmo.
The remaining items:
delegate
property to be filed on ESTreeyield
inside an arrow function within a generator