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

Generator #1178

Closed
wants to merge 6 commits into from
Closed

Generator #1178

wants to merge 6 commits into from

Conversation

ariya
Copy link
Contributor

@ariya ariya commented May 13, 2015

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 ESTree
  • a new test for yield inside an arrow function within a generator

@ariya
Copy link
Contributor Author

ariya commented May 13, 2015

Now that I'm thinking about it again, I think it should be delegating and not delegate.
Thoughts @ikarienator @jeffmo?

@jeffmo
Copy link
Member

jeffmo commented May 13, 2015

FWIW: I find delegating slightly (not to be overstated) confusing because it's not immediately clear what the delegator/delegate is in the the context (and the meaning of the variable gets a little fuzzy).

Going further, delegates came to mind -- but I realized it's odd because it's unclear that it's referring to the verb (rather than a list of delegates).

Of the names I can think of, isDelegator seems most clear to me. delegating seems survivable.

@nzakas
Copy link
Contributor

nzakas commented May 15, 2015

Seems like a good discussion to move to the ESTree repo for resolution :)

@@ -3616,6 +3692,10 @@
startToken = lookahead;
token = lookahead;

if (matchKeyword('yield')) {
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Contributor Author

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.

@ariya
Copy link
Contributor Author

ariya commented Jun 16, 2015

Since there seems to be no objection, I'm going to land this soon.

@ariya ariya closed this in a7379ac Jun 16, 2015
@ariya ariya deleted the generator branch June 23, 2015 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants