[parser] Exception to 8 and 9 in tagged template (#10567)

This commit is contained in:
piotr 2019-10-17 00:01:22 +02:00 committed by Nicolò Ribaudo
parent 2254542010
commit 5800fc97b3
5 changed files with 16 additions and 0 deletions

View File

@ -1239,6 +1239,14 @@ export default class Tokenizer extends LocationParser {
case charCodes.lineSeparator: case charCodes.lineSeparator:
case charCodes.paragraphSeparator: case charCodes.paragraphSeparator:
return ""; return "";
case charCodes.digit8:
case charCodes.digit9:
if (inTemplate) {
const codePos = this.state.pos - 1;
this.state.invalidTemplateEscapePosition = codePos;
return null;
}
default: default:
if (ch >= charCodes.digit0 && ch <= charCodes.digit7) { if (ch >= charCodes.digit0 && ch <= charCodes.digit7) {
const codePos = this.state.pos - 1; const codePos = this.state.pos - 1;

View File

@ -0,0 +1 @@
`\8`;

View File

@ -0,0 +1,3 @@
{
"throws": "Invalid escape sequence in template (1:2)"
}

View File

@ -0,0 +1 @@
`\9`;

View File

@ -0,0 +1,3 @@
{
"throws": "Invalid escape sequence in template (1:2)"
}