New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unicode handling in generated function names #14047
Changes from 1 commit
673c623
af6dcf7
70c508f
feaed13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var o = { | ||
"\uD835\uDC9C"() {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new test cases use var o = {
"\uD835\uDC9C": function () {}
} When unicode escapes are supported, the output should be var o = {
"\uD835\uDC9C": function 𝒜() {}
}; otherwise, the output should be var o = {
"\uD835\uDC9C": function () {}
}; In this case the plugin does nothing. |
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
The-x-Theorist marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"sourceType": "unambiguous", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to specify it; the default (script) is ok to reproduce the bug. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I will change it. |
||
"presets": ["env"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The plugin enabled by preset env will not always be the same. Can you enable just this plugin instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I will enable only the plugin. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we don't use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the plugin refers to the |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var o = { | ||
"\uD835\uDC9C": function () {} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: won't this get transpiled into an unnecessarily complex regex without unicode flag?
I mean,
/[\uD800-\uDFFF]/.test(name)
would work as well, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolo-ribaudo suggested me to use this #14047 in this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We transpile our code targeting Node.js 6, so we don't transpile the
u
flag. However yes,/[\uD800-\uDFFF]/.test(name)
would work too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW
/[\uD800-\uDFFF]/
are not equivalent to/[\u{10000}-\u{10ffff}]/u
because lone surrogate can be a valid string literal. 🤦There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so
/[\uD800-\uDFFF]/
is the correct one in this case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will change it to
/[\uD800-\uDFFF]/
.