-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Remove errors for invalid escape sequences in tagged template literals #41030
Conversation
Happy new financial year (in Japan)!! 🌸🥳 |
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.
I don't think that this is a good approach since it complicates the template parsing code (and only when tags are used?) but it can be simpler to handle all strings in one place instead since they all go through the same place. I posted a comment listing how this can be done.
(Oh, I'm guessing that the tag thing is to deal with raw-tagged strings (#42887); in any case, I think that it's better to fix that case after dealing with the general string case.)
Thank you for your reviews! |
Happy hacktoberfest! 🎃🥳
Fixes #39715.
Also gives a partial fix to #396.
Example
Code
Current Behavior
New Behavior
(Error disappeared from tagged template literal, and new error for octal escape sequence in untagged template literal)
Implementation Detail
With this PR, invalid escape sequences do not emit errors when they are first scanned. Untagged template literals with invalid escape sequence in it are re-scanned to emit syntax errors.