Parse BigInts by default (#11117)

This commit is contained in:
Nicolò Ribaudo 2020-03-16 22:59:45 +01:00 committed by GitHub
parent 1971b7e87d
commit 2bce1e5e20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 18 additions and 28 deletions

View File

@ -996,11 +996,9 @@ export default class Tokenizer extends LocationParser {
this.raise(this.state.start + 2, Errors.InvalidDigit, radix);
}
if (this.hasPlugin("bigInt")) {
if (this.input.charCodeAt(this.state.pos) === charCodes.lowercaseN) {
++this.state.pos;
isBigInt = true;
}
if (this.input.charCodeAt(this.state.pos) === charCodes.lowercaseN) {
++this.state.pos;
isBigInt = true;
}
if (isIdentifierStart(this.input.codePointAt(this.state.pos))) {
@ -1071,16 +1069,14 @@ export default class Tokenizer extends LocationParser {
}
}
if (this.hasPlugin("bigInt")) {
if (next === charCodes.lowercaseN) {
// disallow floats, legacy octal syntax and non octal decimals
// new style octal ("0o") is handled in this.readRadixNumber
if (isFloat || octal || isNonOctalDecimalInt) {
this.raise(start, "Invalid BigIntLiteral");
}
++this.state.pos;
isBigInt = true;
if (next === charCodes.lowercaseN) {
// disallow floats, legacy octal syntax and non octal decimals
// new style octal ("0o") is handled in this.readRadixNumber
if (isFloat || octal || isNonOctalDecimalInt) {
this.raise(start, "Invalid BigIntLiteral");
}
++this.state.pos;
isBigInt = true;
}
if (isIdentifierStart(this.input.codePointAt(this.state.pos))) {

View File

@ -1,3 +1,3 @@
{
"plugins": ["estree", "bigInt"]
"plugins": ["estree"]
}

View File

@ -1,3 +0,0 @@
{
"plugins": ["bigInt"]
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["bigInt", "numericSeparator"]
"plugins": ["numericSeparator"]
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["bigInt", "numericSeparator"]
"plugins": ["numericSeparator"]
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["bigInt", "numericSeparator"]
"plugins": ["numericSeparator"]
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["bigInt", "numericSeparator"]
"plugins": ["numericSeparator"]
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["bigInt", "numericSeparator"]
"plugins": ["numericSeparator"]
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["bigInt", "numericSeparator"]
"plugins": ["numericSeparator"]
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["bigInt", "numericSeparator"]
"plugins": ["numericSeparator"]
}