Improve parse error for double comma somewhere inside a call expression#20399
Merged
1 commit merged intoJan 8, 2018
Merged
Conversation
ghost
commented
Dec 1, 2017
|
|
||
| var p1 = import(...a); | ||
| const p2 = import(); | ||
| const p3 = import(,); |
Author
There was a problem hiding this comment.
Had to remove this line as it's now a parse error and not a grammar error, and a parse error would make all of the grammar errors disappear (see grammarErrorAtPos in checker.ts).
070f3c5 to
3876b9a
Compare
Author
|
@rbuckton Could you review? |
mhegazy
approved these changes
Jan 8, 2018
This pull request was closed.
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.
Fixes #20376
Simplifies the parse error for this case:
Currently this results in parse errors all over after the
,,because it causes us to abort parsing the object literal and expect another argument expression. (Then we see the}and it gets worse from there.)In
isInSomeParsingContextwe iterate through all parsing contexts. That means that so long as we're somewhere in a call expression, any extra comma will abort parsing the current list.In this example that's undesirable -- the comma shouldn't break us out of the object literal.
The problem was that
isListElementreturnedtruefor a comma, but a comma isn't an arguments list element; that's only needed for parsing anOmittedExpressionin an array literal.