Quote only names that need to be quoted, not the reverse#5641
Merged
Conversation
Member
|
👍 |
1 similar comment
Contributor
|
👍 |
Member
There was a problem hiding this comment.
- the brackets are not needed (as we discussed in person).
- Why have
+after[A-Za-z_]? I would think that\w*is enough on its own to match identifier characters. - Does \w match the characters that are valid in Unicode identifiers? IS there any easy way to match those characters?
Member
Author
There was a problem hiding this comment.
Re 3, I don't know. The failure mode here is that we quote something that didn't need to be quoted, which isn't really a problem per se
RyanCavanaugh
added a commit
that referenced
this pull request
Nov 12, 2015
Quote only names that need to be quoted, not the reverse
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 #5634
The code for detecting when to quote the property names in object literals when emitting React was spectacularly wrong. On account of being doubly wrong, this turned out to be mostly right, but it was still really bad:
x-ydidn't need quoting because it matched the substringx.*character was inside the[], which meant we were looking for a literal*instead of "0 or more" of the thing inside the[]