-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/typescript): Handle enum in single statement (#9532)
**Related issue:** - Closes #9531
- Loading branch information
1 parent
c7fdd6b
commit 84b0043
Showing
9 changed files
with
161 additions
and
10 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_ecma_transforms_typescript: patch | ||
swc_core: patch | ||
--- | ||
|
||
fix(es/typescript): Handle enum in single statement |
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 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript" | ||
}, | ||
"target": "es2022" | ||
}, | ||
"isModule": true | ||
} |
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 @@ | ||
if(true) enum A {} | ||
do enum B {} while(false); | ||
while(false) enum C {}; | ||
for (;false;) enum D {}; | ||
for (const a in {}) enum E {}; | ||
for (const a of []) enum F {}; |
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,28 @@ | ||
if (true) { | ||
var A; | ||
(function(A) {})(A || (A = {})); | ||
} | ||
do { | ||
var B; | ||
(function(B) {})(B || (B = {})); | ||
}while (false) | ||
while(false){ | ||
var C; | ||
(function(C) {})(C || (C = {})); | ||
} | ||
; | ||
for(; false;){ | ||
var D; | ||
(function(D) {})(D || (D = {})); | ||
} | ||
; | ||
for(const a in {}){ | ||
var E; | ||
(function(E) {})(E || (E = {})); | ||
} | ||
; | ||
for (const a of []){ | ||
var F; | ||
(function(F) {})(F || (F = {})); | ||
} | ||
; |
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,7 +1,8 @@ | ||
//// [constEnum4.ts] | ||
if (1) const enum A { | ||
} | ||
else if (2) const enum B { | ||
} | ||
else const enum C { | ||
if (1) { | ||
var A; | ||
} else if (2) { | ||
var B; | ||
} else { | ||
var C; | ||
} |
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 @@ | ||
//// [constEnum4.ts] | ||
const enum A { | ||
} |
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