Uh oh!
There was an error while loading. Please reload this page.
Remove errors for invalid escape sequences in tagged template literals - #41030
Remove errors for invalid escape sequences in tagged template literals#41030uhyo (uhyo) wants to merge 6 commits into
Conversation
uhyo (uhyo)
commented
Apr 1, 2021
Happy new financial year (in Japan)!! 🌸🥳 |
There was a problem hiding this comment.
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.)
uhyo (uhyo)
commented
Jun 3, 2021
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.