This repository was archived by the owner on May 19, 2018. It is now read-only.
Annotate more errors with expected token#172
Merged
hzoo merged 1 commit intobabel:masterfrom Oct 14, 2016
Merged
Conversation
Expanding on babel#150, this allows `unexpected()` to accept the expected token type instead of a message string. This overload is then used in a couple more places (that independently implement a logic similar to `expect()`'s) to construct an `Unexpected token, expected FOO` message.
danez
reviewed
Oct 14, 2016
|
|
||
| pp.semicolon = function () { | ||
| if (!this.isLineTerminator()) this.unexpected(); | ||
| if (!this.isLineTerminator()) this.unexpected(null, tt.semi); |
Member
There was a problem hiding this comment.
Also a newline would be expected here I think.
Contributor
Author
There was a problem hiding this comment.
Yeah. Do you have a preference as to the message here? Expected ; or newline?
Member
|
@motiz88 Can you have a look and see why the babel tests now fail with this PR? One sems fine, but have no idea about the other failure. |
Contributor
Author
|
@danez Those are both assertions on messages that have changed in this PR. Not sure why one of them ( PR to make Babel tests pass with the new messages: babel/babel#4727 |
motiz88
added a commit
to motiz88/babel
that referenced
this pull request
Oct 14, 2016
hzoo
pushed a commit
to babel/babel
that referenced
this pull request
Oct 14, 2016
Merged
chrisprice
pushed a commit
to chrisprice/babel
that referenced
this pull request
Oct 18, 2016
kristofdegrave
pushed a commit
to kristofdegrave/babylon
that referenced
this pull request
Oct 27, 2016
Expanding on babel#150, this allows `unexpected()` to accept the expected token type instead of a message string. This overload is then used in a couple more places (that independently implement a logic similar to `expect()`'s) to construct an `Unexpected token, expected FOO` message.
kristofdegrave
pushed a commit
to kristofdegrave/babylon
that referenced
this pull request
Oct 27, 2016
panagosg7
pushed a commit
to panagosg7/babel
that referenced
this pull request
Jan 17, 2017
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.
Expanding on #150, this allows
unexpected()to accept the expected token type instead of a message string. This overload is then used in a couple more places (that essentially reimplementexpect()) to construct anUnexpected token, expected FOOmessage.I can imagine a future enhancement to
unexpected()in which it would similarly take an array of token types; then we could sayexpected FOO or BAR or BAZwhere it makes sense.