-
-
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/transforms): Fix bugs (#2249)
swc_ecma_transforms_compat: - Fix `this` in class properties. (#2228) swc_ecma_transforms_typescript: - Handle `import =` correctly. (#2234) - Ensure that #1653 is not the case anymore. (#1653) swc: - Ensure that #2232 is not the case. (#2232)
- Loading branch information
Showing
28 changed files
with
430 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
9 changes: 9 additions & 0 deletions
9
ecmascript/transforms/compat/tests/fixture/async-to-generator/issue-2248/exec.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,9 @@ | ||
const foo = async () => { | ||
try { | ||
console.log(1) | ||
} catch (err) { | ||
console.log(err.message) | ||
} | ||
} | ||
|
||
foo() |
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
ecmascript/transforms/compat/tests/fixture/classes/issue-2228/case1/exec.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,22 @@ | ||
class Foo { } | ||
|
||
class Bar extends Foo { | ||
events = { | ||
"abc: click": function abcClick() { | ||
this.data = 123; | ||
console.log(this); | ||
} | ||
} | ||
|
||
setData() { | ||
this.data = 456 | ||
} | ||
} | ||
|
||
const bar = new Bar(); | ||
console.log(bar.data); | ||
console.log(bar.events) | ||
console.log(bar.events["abc: click"]()); | ||
console.log(bar.data); | ||
bar.setData(); | ||
console.log(bar.data); |
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
25 changes: 25 additions & 0 deletions
25
ecmascript/transforms/typescript/tests/fixture/.issue-2243/input.ts
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,25 @@ | ||
export function Colors(member: Colors.KeyType): Colors { | ||
return Colors.ValueFor(member); | ||
} | ||
|
||
export module Colors { | ||
export type KeyType = keyof typeof ValueMap; | ||
|
||
export const ValueMap = { | ||
Red: { value: 0.0, label: 'Red' }, | ||
Blue: { value: 1.0, label: 'Blue' }, | ||
Green: { value: 2.0, label: 'Green' }, | ||
} as const; | ||
|
||
export const Values: Colors[] = [0.0, 1.0, 2.0]; | ||
|
||
export function ValueFor(member: KeyType): Colors { | ||
return ValueMap[member]?.value; | ||
} | ||
|
||
export function LabelFor( | ||
member: KeyType | ||
): Promise<string | undefined> { | ||
return ValueMap[member]?.label; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
ecmascript/transforms/typescript/tests/fixture/issue-1653/input.ts
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,11 @@ | ||
namespace X { | ||
export namespace Z { | ||
export const foo = 0 | ||
} | ||
} | ||
|
||
namespace Y { | ||
export namespace Z { | ||
export const bar = 1 | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
ecmascript/transforms/typescript/tests/fixture/issue-1653/output.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,18 @@ | ||
var X; | ||
(function(X) { | ||
var Z; | ||
(function(Z) { | ||
Z.foo = 0; | ||
})(Z || (Z = { | ||
})); | ||
X.Z = Z; | ||
})(X || (X = { | ||
})); | ||
var Y; | ||
(function(Y) { | ||
(function(Z) { | ||
Z.bar = 1; | ||
})(Z || (Z = { | ||
})); | ||
})(Y || (Y = { | ||
})); |
8 changes: 8 additions & 0 deletions
8
ecmascript/transforms/typescript/tests/fixture/issue-2234/input.ts
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,8 @@ | ||
namespace Shapes { | ||
export namespace Polygons { | ||
export class Triangle { } | ||
export class Square { } | ||
} | ||
} | ||
import polygons = Shapes.Polygons; | ||
let sq = new polygons.Square(); |
Oops, something went wrong.