-
-
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 ASI hazards in fast type strip
- Loading branch information
1 parent
1ccbbf0
commit 844ba71
Showing
4 changed files
with
201 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
class A { | ||
foo = 1 | ||
; ["bar"] = 2; | ||
|
||
x = 1 | ||
; ["y"](){} | ||
|
||
z = 1 | ||
static ["w"](){} | ||
} | ||
|
||
class Test { | ||
x = 1 | ||
; *f() {} | ||
} | ||
|
||
class Test2 { | ||
out = 'out' | ||
; in | ||
name | ||
} | ||
|
||
class Test3 { | ||
out = 'out' | ||
; in | ||
name; | ||
|
||
x = 'x' | ||
; instanceof | ||
String | ||
} | ||
|
||
class Test4 { | ||
set; | ||
a(x) {} | ||
get; | ||
b() {} | ||
static; | ||
c(x) {} | ||
} |
33 changes: 33 additions & 0 deletions
33
crates/swc_fast_ts_strip/tests/fixture/issue-9681.transform.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,33 @@ | ||
class A { | ||
foo = 1; | ||
["bar"] = 2; | ||
x = 1; | ||
["y"]() {} | ||
z = 1; | ||
static ["w"]() {} | ||
} | ||
class Test { | ||
x = 1; | ||
*f() {} | ||
} | ||
class Test2 { | ||
out = 'out'; | ||
in; | ||
name; | ||
} | ||
class Test3 { | ||
out = 'out'; | ||
in; | ||
name; | ||
x = 'x'; | ||
instanceof; | ||
String; | ||
} | ||
class Test4 { | ||
set; | ||
a(x) {} | ||
get; | ||
b() {} | ||
static; | ||
c(x) {} | ||
} |
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,40 @@ | ||
class A { | ||
foo = 1 | ||
private ["bar"] = 2; | ||
|
||
x = 1 | ||
public ["y"](){} | ||
|
||
z = 1 | ||
public static ["w"](){} | ||
} | ||
|
||
class Test { | ||
x = 1 | ||
public *f() {} | ||
} | ||
|
||
class Test2 { | ||
out = 'out' | ||
public in | ||
public name | ||
} | ||
|
||
class Test3 { | ||
out = 'out' | ||
public in: any | ||
name; | ||
|
||
x = 'x' | ||
public instanceof: any | ||
String: any | ||
} | ||
|
||
class Test4 { | ||
set: any | ||
a(x) {} | ||
get: any | ||
b() {} | ||
static: any | ||
c(x) {} | ||
} |