Better error output for await in non-async functions #113
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: #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:
|
This issue has been moved to babel/babel#6720. |
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: