Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[parser] Invalid NonOctal Decimal (#10467)
* Add test * Add nonOctalDecimal verification * Update regex and code style * Refactor non octal detection * Add numeric separator test * Disallow numeric separators in non octals * Update whitelist * Better test naming * Disallow numeric separators in non oct for all numbers * Specific error above the general error * Add test for invalid leading zero in num separator * Add start position to error
- Loading branch information
1 parent
f339d2d
commit 69d00dc
Showing
9 changed files
with
27 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ges/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
089n |
1 change: 1 addition & 0 deletions
1
...babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "throws": "Invalid BigIntLiteral (1:0)" } |
1 change: 1 addition & 0 deletions
1
...s/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0_8 |
1 change: 1 addition & 0 deletions
1
...bel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "throws": "Numeric separator can not be used after leading 0 (1:1)" } |
1 change: 1 addition & 0 deletions
1
...arser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
08_0n |
1 change: 1 addition & 0 deletions
1
...r/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "throws": "Numeric separator can not be used after leading 0 (1:2)" } |
2 changes: 1 addition & 1 deletion
2
packages/babel-parser/test/fixtures/experimental/numeric-separator/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"plugins": ["numericSeparator"] | ||
"plugins": ["bigInt", "numericSeparator"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters