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
Better error output for await in non-async functions #6720
Comments
Hi! I'm trying to implement this and learn some Babylon internals at the same time. tl;dr: I have a question about a specific implementation idea - see the very end 💭 Larger discussion:
|
Just realized there actually is a PR open already (sorry, thought that only discussion had occurred), so I'll go ahead and close mine. |
@motiz88 Actually, looked at your PR and the solution I came up with is very different. Don't want to step on your toes here, but let me know what you think of this: https://github.com/babel/babylon/compare/master...kaicataldo:betterawaiterrormessaging?expand=1 If you think it looks good, I can make a PR with this - just wanted to check in with you since you've already done work on this. These changes would also fix part of this issue: babel/babylon#134, warning for when |
I'm actually going to see if I can extract the reserved identifier checks out so it's easier to see how all this fits together. Running into some challenges with my own solution - it works great when source type is module, but might actually have to do some kind of flag in state when an |
Hey @kaicataldo, apparently GitHub lost a reply I sent via e-mail so I'll try to address everything again. For one thing, don't worry about my toes 😄 Especially since my PR is a work-in-progress and in a bit of stasis at the moment. But I think allowing My own solution can probably be simplified and made more correct with the use of
is exactly what I did. |
Hey @kaicataldo, don't worry about my toes 😄 But doesn't your current On Oct 23, 2016 06:08, "Kai Cataldo" notifications@github.com wrote:
|
From https://twitter.com/sebmck/status/1031978115881291776
We can just cover the basic case for now |
Is someone working on this right now? Are there any open PRs? |
@aulisius not at the moment! |
Cool! I'll like to take a crack at it, then :D ! |
@aulisius awesome! feel to free to join us on slack if you haven't already! |
How's the progress on this one? I'd like to give it a shot! |
You can work on this 🙂 |
Awesome 😄 |
The output is now Closing as I think the output is better now. |
Throws:
Unexpected token(2:8)
This is a bit misleading. Can we change this to say something like "await can only be used in async functions"?
Thanks.
The text was updated successfully, but these errors were encountered: