Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't duplicate the base class when using
constantSuper
(#13303)
- Loading branch information
1 parent
3195883
commit 989aac2
Showing
10 changed files
with
77 additions
and
33 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
3 changes: 3 additions & 0 deletions
3
...osal-class-properties/test/fixtures/assumption-constantSuper/complex-super-class/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,3 @@ | ||
class A extends class B {} { | ||
static x = super.x; | ||
} |
5 changes: 5 additions & 0 deletions
5
...sal-class-properties/test/fixtures/assumption-constantSuper/complex-super-class/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,5 @@ | ||
var _B; | ||
|
||
class A extends (_B = class B {}) {} | ||
|
||
babelHelpers.defineProperty(A, "x", _B.x); |
3 changes: 3 additions & 0 deletions
3
...-proposal-class-properties/test/fixtures/assumption-constantSuper/instance-field/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,3 @@ | ||
class A extends B { | ||
foo = super.bar; | ||
} |
7 changes: 7 additions & 0 deletions
7
...proposal-class-properties/test/fixtures/assumption-constantSuper/instance-field/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,7 @@ | ||
class A extends B { | ||
constructor(...args) { | ||
super(...args); | ||
babelHelpers.defineProperty(this, "foo", super.bar); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
...abel-plugin-proposal-class-properties/test/fixtures/assumption-constantSuper/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 @@ | ||
{ | ||
"assumptions": { | ||
"constantSuper": true | ||
}, | ||
"plugins": ["proposal-class-properties"] | ||
} |
3 changes: 3 additions & 0 deletions
3
...in-proposal-class-properties/test/fixtures/assumption-constantSuper/static-field/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,3 @@ | ||
class A extends B { | ||
static foo = super.bar; | ||
} |
3 changes: 3 additions & 0 deletions
3
...n-proposal-class-properties/test/fixtures/assumption-constantSuper/static-field/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,3 @@ | ||
class A extends B {} | ||
|
||
babelHelpers.defineProperty(A, "foo", B.bar); |
12 changes: 4 additions & 8 deletions
12
...-proposal-class-static-block/test/fixtures/integration-loose/super-static-block/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 |
---|---|---|
@@ -1,17 +1,13 @@ | ||
var _class, _temp; | ||
var _ref, _class, _temp; | ||
|
||
class Foo extends (_temp = _class = class {}, (() => { | ||
class Foo extends (_ref = (_temp = _class = class _ref {}, (() => { | ||
_class.bar = 42; | ||
})(), _temp) {} | ||
})(), _temp)) {} | ||
|
||
Foo.bar = 21; | ||
|
||
(() => { | ||
var _class2, _temp2; | ||
|
||
Foo.foo = (_temp2 = _class2 = class {}, (() => { | ||
_class2.bar = 42; | ||
})(), _temp2).bar; | ||
Foo.foo = _ref.bar; | ||
})(); | ||
|
||
expect(Foo.foo).toBe(42); |