Skip to content

Commit

Permalink
Parse BigInts by default (#11117)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Mar 16, 2020
1 parent 1971b7e commit 2bce1e5
Show file tree
Hide file tree
Showing 33 changed files with 18 additions and 28 deletions.
24 changes: 10 additions & 14 deletions packages/babel-parser/src/tokenizer/index.js
Expand Up @@ -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))) {
Expand Down Expand Up @@ -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))) {
Expand Down
@@ -1,3 +1,3 @@
{
"plugins": ["estree", "bigInt"]
"plugins": ["estree"]
}

This file was deleted.

This file was deleted.

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

0 comments on commit 2bce1e5

Please sign in to comment.