Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow redeclaration of enum with const enum
- Loading branch information
1 parent
b93bbc7
commit be8e163
Showing
9 changed files
with
154 additions
and
25 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
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
2 changes: 2 additions & 0 deletions
2
...es/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-constenum/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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
const enum Foo {} | |||
const enum Foo {} |
103 changes: 103 additions & 0 deletions
103
...babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-constenum/output.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,103 @@ | |||
{ | |||
"type": "File", | |||
"start": 0, | |||
"end": 35, | |||
"loc": { | |||
"start": { | |||
"line": 1, | |||
"column": 0 | |||
}, | |||
"end": { | |||
"line": 2, | |||
"column": 17 | |||
} | |||
}, | |||
"program": { | |||
"type": "Program", | |||
"start": 0, | |||
"end": 35, | |||
"loc": { | |||
"start": { | |||
"line": 1, | |||
"column": 0 | |||
}, | |||
"end": { | |||
"line": 2, | |||
"column": 17 | |||
} | |||
}, | |||
"sourceType": "module", | |||
"interpreter": null, | |||
"body": [ | |||
{ | |||
"type": "TSEnumDeclaration", | |||
"start": 0, | |||
"end": 17, | |||
"loc": { | |||
"start": { | |||
"line": 1, | |||
"column": 0 | |||
}, | |||
"end": { | |||
"line": 1, | |||
"column": 17 | |||
} | |||
}, | |||
"const": true, | |||
"id": { | |||
"type": "Identifier", | |||
"start": 11, | |||
"end": 14, | |||
"loc": { | |||
"start": { | |||
"line": 1, | |||
"column": 11 | |||
}, | |||
"end": { | |||
"line": 1, | |||
"column": 14 | |||
}, | |||
"identifierName": "Foo" | |||
}, | |||
"name": "Foo" | |||
}, | |||
"members": [] | |||
}, | |||
{ | |||
"type": "TSEnumDeclaration", | |||
"start": 18, | |||
"end": 35, | |||
"loc": { | |||
"start": { | |||
"line": 2, | |||
"column": 0 | |||
}, | |||
"end": { | |||
"line": 2, | |||
"column": 17 | |||
} | |||
}, | |||
"const": true, | |||
"id": { | |||
"type": "Identifier", | |||
"start": 29, | |||
"end": 32, | |||
"loc": { | |||
"start": { | |||
"line": 2, | |||
"column": 11 | |||
}, | |||
"end": { | |||
"line": 2, | |||
"column": 14 | |||
}, | |||
"identifierName": "Foo" | |||
}, | |||
"name": "Foo" | |||
}, | |||
"members": [] | |||
} | |||
], | |||
"directives": [] | |||
} | |||
} |
2 changes: 2 additions & 0 deletions
2
packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
const enum X {} | |||
enum X {} |
3 changes: 3 additions & 0 deletions
3
...ges/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
{ | |||
"throws": "Identifier 'X' has already been declared (2:5)" | |||
} |
2 changes: 2 additions & 0 deletions
2
packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
enum X {} | |||
const enum X {} |
3 changes: 3 additions & 0 deletions
3
...ges/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
{ | |||
"throws": "Identifier 'X' has already been declared (2:11)" | |||
} |