-
-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transformer/class-properties): do not transform
super.prop
in n…
…ested method within static prop initializer
- Loading branch information
1 parent
ff9d1b3
commit d1c0dd2
Showing
4 changed files
with
108 additions
and
6 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
37 changes: 37 additions & 0 deletions
37
...plugin-transform-class-properties/test/fixtures/super-in-static-prop-initializer/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,37 @@ | ||
class C { | ||
static prop = () => { | ||
// Transform | ||
super.prop; | ||
super[prop]; | ||
super.prop(); | ||
super[prop](); | ||
|
||
const obj = { | ||
method() { | ||
// Don't transform | ||
super.prop; | ||
super[prop]; | ||
super.prop(); | ||
super[prop](); | ||
} | ||
}; | ||
|
||
class Inner { | ||
method() { | ||
// Don't transform | ||
super.prop; | ||
super[prop]; | ||
super.prop(); | ||
super[prop](); | ||
} | ||
|
||
static staticMethod() { | ||
// Don't transform | ||
super.prop; | ||
super[prop]; | ||
super.prop(); | ||
super[prop](); | ||
} | ||
} | ||
}; | ||
} |
38 changes: 38 additions & 0 deletions
38
...lugin-transform-class-properties/test/fixtures/super-in-static-prop-initializer/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,38 @@ | ||
var _C; | ||
class C {} | ||
_C = C; | ||
babelHelpers.defineProperty(C, "prop", () => { | ||
// Transform | ||
babelHelpers.superPropGet(_C, "prop", _C); | ||
babelHelpers.superPropGet(_C, prop, _C); | ||
babelHelpers.superPropGet(_C, "prop", _C, 2)([]); | ||
babelHelpers.superPropGet(_C, prop, _C, 2)([]); | ||
|
||
const obj = { | ||
method() { | ||
// Don't transform | ||
super.prop; | ||
super[prop]; | ||
super.prop(); | ||
super[prop](); | ||
} | ||
}; | ||
|
||
class Inner { | ||
method() { | ||
// Don't transform | ||
super.prop; | ||
super[prop]; | ||
super.prop(); | ||
super[prop](); | ||
} | ||
|
||
static staticMethod() { | ||
// Don't transform | ||
super.prop; | ||
super[prop]; | ||
super.prop(); | ||
super[prop](); | ||
} | ||
} | ||
}); |