Commit 6b3644b
authored
fix(es/parser): Disallow NumericLiteralSeparator with BigInts (#11510)
**Description:**
I'm using swc in my JS Engine
[Yavashark](github.com/Sharktheone/yavashark). I noticed, some test262
tests that were crashing in swc internally. Example:
[test262](https://github.com/tc39/test262/blob/main/test/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd-err.js),
[result](https://yavashark.dev/test262/#/v/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd-err.js).
These tests are panicking because there was a missing check whether the
literal contains any separators / underscores which would cause a
failure in the `num_bigint` parser.
I've also added a fallback to not panic even when the `num_bigint` parse
fails.1 parent b94a178 commit 6b3644b
2 files changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1160 | 1160 | | |
1161 | 1161 | | |
1162 | 1162 | | |
1163 | | - | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1164 | 1178 | | |
1165 | 1179 | | |
1166 | 1180 | | |
| |||
0 commit comments