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

Syntax #12

Open
mnieper opened this issue Feb 9, 2015 · 7 comments
Open

Syntax #12

mnieper opened this issue Feb 9, 2015 · 7 comments

Comments

@mnieper
Copy link

mnieper commented Feb 9, 2015

In the async generator examples, a syntax like

await yield f()

is used. However, this does not seem to be parseable by the ES6 grammar and https://github.com/lukehoban/ecmascript-asyncawait. await expects an UnaryExpression, while yield produces an AssignmentExpression.

@zenparsing
Copy link

Good point. It would have to be

await (yield f())

@mnieper
Copy link
Author

mnieper commented Feb 13, 2015

In the implementation in Traceur, I have added a parser rule for await yield without parens. I think this grammar change should be added to this or @lukehoban's proposal because await yield will be a common idiom with async generators in place.

@zenparsing
Copy link

@mnieper What is the grammar rule you are proposing?

@mnieper
Copy link
Author

mnieper commented Feb 13, 2015

I don't speak Ecma, but I wouldn't it suffice to say

UnaryExpression :
    ...
    await [Lexical goal InputElementRegExp] UnaryExpression
    await ... YieldExpression

?

@arv
Copy link

arv commented May 1, 2015

@mnieper Trying to clean up our parser a bit and the YieldExpression probably needs a [In] there to allow:

await yield 42 in obj

@mnieper
Copy link
Author

mnieper commented May 4, 2015

Yes, this makes perfect sense.

@bterlson
Copy link

bterlson commented Jun 6, 2015

@mnieper want to file a bug here if you want this syntax in the async functions proposal?

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

4 participants