-
-
Notifications
You must be signed in to change notification settings - Fork 518
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transformer/private-methods): no temp var for class when unused p…
…rivate methods
- Loading branch information
1 parent
e4d66e4
commit 13894e9
Showing
5 changed files
with
52 additions
and
7 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
6 changes: 6 additions & 0 deletions
6
...sform_conformance/tests/babel-plugin-transform-private-methods/test/fixtures/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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"plugins": [ | ||
"transform-class-properties", | ||
"transform-private-methods" | ||
] | ||
} |
15 changes: 15 additions & 0 deletions
15
...rmance/tests/babel-plugin-transform-private-methods/test/fixtures/unused-methods/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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class C { | ||
#method() {} | ||
} | ||
|
||
class C2 { | ||
static #method() {} | ||
} | ||
|
||
const C3 = class { | ||
#method() {} | ||
}; | ||
|
||
const C4 = class { | ||
static #method() {} | ||
}; |
22 changes: 22 additions & 0 deletions
22
...mance/tests/babel-plugin-transform-private-methods/test/fixtures/unused-methods/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,22 @@ | ||
var _Class_brand; | ||
|
||
var _C_brand = new WeakSet(); | ||
class C { | ||
constructor() { | ||
babelHelpers.classPrivateMethodInitSpec(this, _C_brand); | ||
} | ||
} | ||
function _method() {} | ||
|
||
class C2 {} | ||
function _method2() {} | ||
|
||
const C3 = (_Class_brand = new WeakSet(), class { | ||
constructor() { | ||
babelHelpers.classPrivateMethodInitSpec(this, _Class_brand); | ||
} | ||
}); | ||
function _method3() {} | ||
|
||
const C4 = class {}; | ||
function _method4() {} |