-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(es/parser): Disallow
let let
(#9484)
**Related issue:** - Closes #8269
- Loading branch information
Showing
20 changed files
with
86 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
swc_core: patch | ||
swc_ecma_parser: patch | ||
--- | ||
|
||
feat(es/parser): Disallow `let let` |
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
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
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
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
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
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
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
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
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
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,9 @@ | ||
{ | ||
let let | ||
} | ||
{ | ||
const let = 0 | ||
} | ||
{ | ||
class let { } | ||
} |
7 changes: 7 additions & 0 deletions
7
crates/swc_ecma_parser/tests/errors/issue-8269/input.js.swc-stderr
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,7 @@ | ||
x Unexpected token `let`. Expected let is reserved in const, let, class declaration | ||
,-[$DIR/tests/errors/issue-8269/input.js:2:1] | ||
1 | { | ||
2 | let let | ||
: ^^^ | ||
3 | } | ||
`---- |
4 changes: 2 additions & 2 deletions
4
crates/swc_ecma_parser/tests/test262-error-references/fail/0abefbc80bf651fa.js.swc-stderr
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,5 +1,5 @@ | ||
x Expression expected | ||
x Unexpected token `let`. Expected let is reserved in const, let, class declaration | ||
,-[$DIR/tests/test262-parser/fail/0abefbc80bf651fa.js:1:1] | ||
1 | for (let let;;;) {} | ||
: ^ | ||
: ^^^ | ||
`---- |
4 changes: 2 additions & 2 deletions
4
crates/swc_ecma_parser/tests/test262-error-references/fail/39551fb86dcd3b29.js.swc-stderr
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,5 +1,5 @@ | ||
x Expression expected | ||
x Unexpected token `let`. Expected let is reserved in const, let, class declaration | ||
,-[$DIR/tests/test262-parser/fail/39551fb86dcd3b29.js:1:1] | ||
1 | for (const let = 1;;;) {} | ||
: ^ | ||
: ^^^ | ||
`---- |
4 changes: 2 additions & 2 deletions
4
crates/swc_ecma_parser/tests/test262-error-references/fail/49624f905645b7d0.js.swc-stderr
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,5 +1,5 @@ | ||
x Expression expected | ||
x Unexpected token `let`. Expected let is reserved in const, let, class declaration | ||
,-[$DIR/tests/test262-parser/fail/49624f905645b7d0.js:1:1] | ||
1 | for (let x, y, z, let;;;) {} | ||
: ^ | ||
: ^^^ | ||
`---- |
4 changes: 2 additions & 2 deletions
4
crates/swc_ecma_parser/tests/test262-error-references/fail/ac4ee5fb095faad0.js.swc-stderr
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,5 +1,5 @@ | ||
x Expression expected | ||
x Unexpected token `let`. Expected let is reserved in const, let, class declaration | ||
,-[$DIR/tests/test262-parser/fail/ac4ee5fb095faad0.js:1:1] | ||
1 | for (let x, y, z, let = 1;;;) {} | ||
: ^ | ||
: ^^^ | ||
`---- |
4 changes: 2 additions & 2 deletions
4
crates/swc_ecma_parser/tests/test262-error-references/fail/b02b296bd115b9b9.js.swc-stderr
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,5 +1,5 @@ | ||
x Expression expected | ||
x Unexpected token `let`. Expected let is reserved in const, let, class declaration | ||
,-[$DIR/tests/test262-parser/fail/b02b296bd115b9b9.js:1:1] | ||
1 | for (const x = 1, y = 2, z = 3, let = 0;;;) {} | ||
: ^ | ||
: ^^^ | ||
`---- |
8 changes: 1 addition & 7 deletions
8
crates/swc_ecma_parser/tests/typescript-errors/issue-1391/case2/input.ts.swc-stderr
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,12 +1,6 @@ | ||
x `let` cannot be used as an identifier in strict mode | ||
x Unexpected token `let`. Expected let is reserved in const, let, class declaration | ||
,-[$DIR/tests/typescript-errors/issue-1391/case2/input.ts:2:1] | ||
1 | let a = 0, | ||
2 | let b = 1; | ||
: ^^^ | ||
`---- | ||
x Expected a semicolon | ||
,-[$DIR/tests/typescript-errors/issue-1391/case2/input.ts:2:1] | ||
1 | let a = 0, | ||
2 | let b = 1; | ||
: ^ | ||
`---- |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_parser/tests/typescript-errors/let/index.ts.swc-stderr
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
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