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,12 +996,10 @@ export default class Tokenizer extends LocationParser {
this.raise(this.state.start + 2, Errors.InvalidDigit, radix); this.raise(this.state.start + 2, Errors.InvalidDigit, radix);
} }
if (this.hasPlugin("bigInt")) {
if (this.input.charCodeAt(this.state.pos) === charCodes.lowercaseN) { if (this.input.charCodeAt(this.state.pos) === charCodes.lowercaseN) {
++this.state.pos; ++this.state.pos;
isBigInt = true; isBigInt = true;
} }
}
if (isIdentifierStart(this.input.codePointAt(this.state.pos))) { if (isIdentifierStart(this.input.codePointAt(this.state.pos))) {
throw this.raise(this.state.pos, Errors.NumberIdentifier); throw this.raise(this.state.pos, Errors.NumberIdentifier);
@ -1071,7 +1069,6 @@ export default class Tokenizer extends LocationParser {
} }
} }
if (this.hasPlugin("bigInt")) {
if (next === charCodes.lowercaseN) { if (next === charCodes.lowercaseN) {
// disallow floats, legacy octal syntax and non octal decimals // disallow floats, legacy octal syntax and non octal decimals
// new style octal ("0o") is handled in this.readRadixNumber // new style octal ("0o") is handled in this.readRadixNumber
@ -1081,7 +1078,6 @@ export default class Tokenizer extends LocationParser {
++this.state.pos; ++this.state.pos;
isBigInt = true; isBigInt = true;
} }
}
if (isIdentifierStart(this.input.codePointAt(this.state.pos))) { if (isIdentifierStart(this.input.codePointAt(this.state.pos))) {
throw this.raise(this.state.pos, Errors.NumberIdentifier); throw this.raise(this.state.pos, Errors.NumberIdentifier);

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"]
} }