[parser] Recover after using await expressions in sync contexts#11090
Closed
nicolo-ribaudo wants to merge 1 commit into
Closed
[parser] Recover after using await expressions in sync contexts#11090nicolo-ribaudo wants to merge 1 commit into
nicolo-ribaudo wants to merge 1 commit into
Conversation
nicolo-ribaudo
commented
Feb 3, 2020
Member
| Q | A |
|---|---|
| Fixed Issues? | |
| Patch: Bug Fix? | |
| Major: Breaking Change? | |
| Minor: New Feature? | Yes, but I don't think that it needs to wait for a minor version. |
| Tests Added + Pass? | Yes |
| Documentation PR Link | |
| Any Dependency Changes? | |
| License | MIT |
6c26e5d to
8dcf566
Compare
JLHwung
reviewed
Feb 4, 2020
| }, | ||
| "errors": [ | ||
| "SyntaxError: Await expressions are only allowed inside async functions. (1:11)", | ||
| "SyntaxError: Await cannot be used as name inside an async function (1:11)" |
Contributor
There was a problem hiding this comment.
In this case there are two contradicting errors in the same position, IMO it is confusing and we should fix it.
JLHwung
reviewed
Feb 4, 2020
| : "Await expressions are only allowed inside async functions.", | ||
| ); | ||
|
|
||
| return this.parseAwait(startPos, startLoc); |
Contributor
There was a problem hiding this comment.
We can reset the awaitPos after await expression is parsed since we have thrown an recoverable error before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.