[parser] Exception to 8 and 9 in tagged template (#10567)
This commit is contained in:
parent
2254542010
commit
5800fc97b3
@ -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;
|
||||||
|
|||||||
1
packages/babel-parser/test/fixtures/core/escape-template/non-octal/eight/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/core/escape-template/non-octal/eight/input.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
`\8`;
|
||||||
3
packages/babel-parser/test/fixtures/core/escape-template/non-octal/eight/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/core/escape-template/non-octal/eight/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"throws": "Invalid escape sequence in template (1:2)"
|
||||||
|
}
|
||||||
1
packages/babel-parser/test/fixtures/core/escape-template/non-octal/nine/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/core/escape-template/non-octal/nine/input.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
`\9`;
|
||||||
3
packages/babel-parser/test/fixtures/core/escape-template/non-octal/nine/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/core/escape-template/non-octal/nine/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"throws": "Invalid escape sequence in template (1:2)"
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user