Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix class fields when
super()
is in a default param (#12729)
* Fix class fields when `super()` is in a default param * Use assertion instead of type cast
- Loading branch information
1 parent
60ef190
commit bab5c62
Showing
10 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...al-class-properties/test/fixtures/public/derived-super-in-default-params-complex/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 Foo extends Bar { | ||
bar = "foo"; | ||
|
||
constructor(x = test ? super() : 0) { | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...lass-properties/test/fixtures/public/derived-super-in-default-params-complex/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": [ | ||
["external-helpers", { "helperVersion": "7.100.0" }], | ||
"proposal-class-properties" | ||
] | ||
} |
8 changes: 8 additions & 0 deletions
8
...l-class-properties/test/fixtures/public/derived-super-in-default-params-complex/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,8 @@ | ||
class Foo extends Bar { | ||
constructor(x = test ? (() => { | ||
var _temp; | ||
|
||
return _temp = super(), babelHelpers.defineProperty(this, "bar", "foo"), _temp; | ||
})() : 0) {} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
...l-class-properties/test/fixtures/public/derived-super-in-default-params-in-arrow/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 Foo extends Bar { | ||
bar = "foo"; | ||
|
||
constructor(x = () => { check(super()) }) { | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...ass-properties/test/fixtures/public/derived-super-in-default-params-in-arrow/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": [ | ||
["external-helpers", { "helperVersion": "7.100.0" }], | ||
"proposal-class-properties" | ||
] | ||
} |
8 changes: 8 additions & 0 deletions
8
...-class-properties/test/fixtures/public/derived-super-in-default-params-in-arrow/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,8 @@ | ||
class Foo extends Bar { | ||
constructor(x = () => { | ||
var _temp; | ||
|
||
check((_temp = super(), babelHelpers.defineProperty(this, "bar", "foo"), _temp)); | ||
}) {} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
...n-proposal-class-properties/test/fixtures/public/derived-super-in-default-params/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 Foo extends Bar { | ||
bar = "foo"; | ||
|
||
constructor(x = super()) { | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...oposal-class-properties/test/fixtures/public/derived-super-in-default-params/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": [ | ||
["external-helpers", { "helperVersion": "7.100.0" }], | ||
"proposal-class-properties" | ||
] | ||
} |
8 changes: 8 additions & 0 deletions
8
...-proposal-class-properties/test/fixtures/public/derived-super-in-default-params/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,8 @@ | ||
class Foo extends Bar { | ||
constructor(x = (() => { | ||
var _temp; | ||
|
||
return _temp = super(), babelHelpers.defineProperty(this, "bar", "foo"), _temp; | ||
})()) {} | ||
|
||
} |
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