Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support optionalCall in replace super handler (#12238)
- Loading branch information
Showing
7 changed files
with
83 additions
and
0 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
6 changes: 6 additions & 0 deletions
6
...in-transform-classes/test/fixtures/loose/accessing-super-property-optional-chain/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,6 @@ | ||
class Test extends Foo { | ||
constructor() { | ||
super.foo?.bar; | ||
super.foo?.(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...ransform-classes/test/fixtures/loose/accessing-super-property-optional-chain/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,10 @@ | ||
{ | ||
"plugins": [ | ||
["external-helpers", { "helperVersion": "7.100.0" }], | ||
["proposal-optional-chaining", { "loose": true }], | ||
"transform-function-name", | ||
["transform-classes", { "loose": true }], | ||
["transform-spread", { "loose": true }], | ||
"transform-block-scoping" | ||
] | ||
} |
17 changes: 17 additions & 0 deletions
17
...n-transform-classes/test/fixtures/loose/accessing-super-property-optional-chain/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,17 @@ | ||
var Test = /*#__PURE__*/function (_Foo) { | ||
"use strict"; | ||
|
||
babelHelpers.inheritsLoose(Test, _Foo); | ||
|
||
function Test() { | ||
var _Foo$prototype$foo, _Foo$prototype$foo2; | ||
|
||
var _this; | ||
|
||
(_Foo$prototype$foo = _Foo.prototype.foo) == null ? void 0 : _Foo$prototype$foo.bar; | ||
(_Foo$prototype$foo2 = _Foo.prototype.foo) == null ? void 0 : _Foo$prototype$foo2.call(babelHelpers.assertThisInitialized(_this)); | ||
return babelHelpers.assertThisInitialized(_this); | ||
} | ||
|
||
return Test; | ||
}(Foo); |
6 changes: 6 additions & 0 deletions
6
...gin-transform-classes/test/fixtures/spec/accessing-super-property-optional-chain/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,6 @@ | ||
class Test extends Foo { | ||
constructor() { | ||
super.foo?.bar; | ||
super.foo?.(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...transform-classes/test/fixtures/spec/accessing-super-property-optional-chain/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,10 @@ | ||
{ | ||
"plugins": [ | ||
["external-helpers", { "helperVersion": "7.100.0" }], | ||
"proposal-optional-chaining", | ||
"transform-function-name", | ||
"transform-classes", | ||
"transform-spread", | ||
"transform-block-scoping" | ||
] | ||
} |
20 changes: 20 additions & 0 deletions
20
...in-transform-classes/test/fixtures/spec/accessing-super-property-optional-chain/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,20 @@ | ||
var Test = /*#__PURE__*/function (_Foo) { | ||
"use strict"; | ||
|
||
babelHelpers.inherits(Test, _Foo); | ||
|
||
var _super = babelHelpers.createSuper(Test); | ||
|
||
function Test() { | ||
var _babelHelpers$get, _babelHelpers$get2; | ||
|
||
var _thisSuper, _thisSuper2, _this; | ||
|
||
babelHelpers.classCallCheck(this, Test); | ||
(_babelHelpers$get = babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "foo", _thisSuper)) === null || _babelHelpers$get === void 0 ? void 0 : _babelHelpers$get.bar; | ||
(_babelHelpers$get2 = babelHelpers.get((_thisSuper2 = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Test.prototype)), "foo", _thisSuper2)) === null || _babelHelpers$get2 === void 0 ? void 0 : _babelHelpers$get2.call(_thisSuper2); | ||
return babelHelpers.possibleConstructorReturn(_this); | ||
} | ||
|
||
return Test; | ||
}(Foo); |