Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: requeue computed keys of class accessors
- Loading branch information
Showing
12 changed files
with
130 additions
and
17 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
19 changes: 19 additions & 0 deletions
19
...oposal-class-properties/test/fixtures/nested-class/super-property-in-accessor-key/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,19 @@ | ||
"use strict"; | ||
class Hello { | ||
toString() { | ||
return 'hello'; | ||
} | ||
} | ||
|
||
class Outer extends Hello { | ||
constructor() { | ||
super(); | ||
class Inner { | ||
accessor [super.toString()] = 'hello'; | ||
} | ||
|
||
return new Inner(); | ||
} | ||
} | ||
|
||
expect(new Outer().hello).toBe('hello'); |
19 changes: 19 additions & 0 deletions
19
...posal-class-properties/test/fixtures/nested-class/super-property-in-accessor-key/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,19 @@ | ||
"use strict"; | ||
class Hello { | ||
toString() { | ||
return 'hello'; | ||
} | ||
} | ||
|
||
class Outer extends Hello { | ||
constructor() { | ||
super(); | ||
class Inner { | ||
accessor [super.toString()] = 'hello'; | ||
} | ||
|
||
return new Inner(); | ||
} | ||
} | ||
|
||
expect(new Outer().hello).toBe('hello'); |
8 changes: 8 additions & 0 deletions
8
...l-class-properties/test/fixtures/nested-class/super-property-in-accessor-key/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,8 @@ | ||
{ | ||
"plugins": [ | ||
["proposal-decorators", { "version": "2021-12" }], | ||
"proposal-class-static-block", | ||
"proposal-class-properties", | ||
"transform-classes" | ||
] | ||
} |
64 changes: 64 additions & 0 deletions
64
...osal-class-properties/test/fixtures/nested-class/super-property-in-accessor-key/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,64 @@ | ||
"use strict"; | ||
|
||
let Hello = /*#__PURE__*/function () { | ||
function Hello() { | ||
babelHelpers.classCallCheck(this, Hello); | ||
} | ||
|
||
babelHelpers.createClass(Hello, [{ | ||
key: "toString", | ||
value: function toString() { | ||
return 'hello'; | ||
} | ||
}]); | ||
return Hello; | ||
}(); | ||
|
||
let Outer = /*#__PURE__*/function (_Hello) { | ||
babelHelpers.inherits(Outer, _Hello); | ||
|
||
var _super = babelHelpers.createSuper(Outer); | ||
|
||
function Outer() { | ||
let _babelHelpers$get$cal, _babelHelpers$get$cal2; | ||
|
||
var _thisSuper, _this; | ||
|
||
babelHelpers.classCallCheck(this, Outer); | ||
_this = _super.call(this); | ||
|
||
var _A = /*#__PURE__*/new WeakMap(); | ||
|
||
_babelHelpers$get$cal = babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Outer.prototype)), "toString", _thisSuper).call(_thisSuper); | ||
_babelHelpers$get$cal2 = babelHelpers.get((_thisSuper = babelHelpers.assertThisInitialized(_this), babelHelpers.getPrototypeOf(Outer.prototype)), "toString", _thisSuper).call(_thisSuper); | ||
|
||
let Inner = /*#__PURE__*/function () { | ||
function Inner() { | ||
babelHelpers.classCallCheck(this, Inner); | ||
babelHelpers.classPrivateFieldInitSpec(this, _A, { | ||
writable: true, | ||
value: 'hello' | ||
}); | ||
} | ||
|
||
babelHelpers.createClass(Inner, [{ | ||
key: _babelHelpers$get$cal, | ||
get: function () { | ||
return babelHelpers.classPrivateFieldGet(this, _A); | ||
} | ||
}, { | ||
key: _babelHelpers$get$cal2, | ||
set: function (v) { | ||
babelHelpers.classPrivateFieldSet(this, _A, v); | ||
} | ||
}]); | ||
return Inner; | ||
}(); | ||
|
||
return babelHelpers.possibleConstructorReturn(_this, new Inner()); | ||
} | ||
|
||
return babelHelpers.createClass(Outer); | ||
}(Hello); | ||
|
||
expect(new Outer().hello).toBe('hello'); |
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