Throw when compiling spread in super() but not classes (#12722)
* Throw when compiling spread in `super()` but not classes * Add comment
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
class A extends B {
|
||||
constructor() {
|
||||
super(...foo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
["external-helpers", { "helperVersion": "7.100.0" }],
|
||||
"transform-spread",
|
||||
"transform-classes"
|
||||
]
|
||||
}
|
||||
14
packages/babel-plugin-transform-spread/test/fixtures/spread/super-classes-plugin-after/output.js
vendored
Normal file
14
packages/babel-plugin-transform-spread/test/fixtures/spread/super-classes-plugin-after/output.js
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
let A = /*#__PURE__*/function (_B) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(A, _B);
|
||||
|
||||
var _super = babelHelpers.createSuper(A);
|
||||
|
||||
function A() {
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
return _super.call.apply(_super, [this].concat(babelHelpers.toConsumableArray(foo)));
|
||||
}
|
||||
|
||||
return A;
|
||||
}(B);
|
||||
@@ -0,0 +1,5 @@
|
||||
class A extends B {
|
||||
constructor() {
|
||||
super(...foo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
["external-helpers", { "helperVersion": "7.100.0" }],
|
||||
"transform-classes",
|
||||
"transform-spread"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
let A = /*#__PURE__*/function (_B) {
|
||||
"use strict";
|
||||
|
||||
babelHelpers.inherits(A, _B);
|
||||
|
||||
var _super = babelHelpers.createSuper(A);
|
||||
|
||||
function A() {
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
return _super.call.apply(_super, [this].concat(babelHelpers.toConsumableArray(foo)));
|
||||
}
|
||||
|
||||
return A;
|
||||
}(B);
|
||||
5
packages/babel-plugin-transform-spread/test/fixtures/spread/super-no-classes-plugin/input.js
vendored
Normal file
5
packages/babel-plugin-transform-spread/test/fixtures/spread/super-no-classes-plugin/input.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
class A extends B {
|
||||
constructor() {
|
||||
super(...foo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
["external-helpers", { "helperVersion": "7.100.0" }],
|
||||
"transform-spread"
|
||||
],
|
||||
"throws": "It's not possible to compile spread arguments in `super()` without compiling classes."
|
||||
}
|
||||
Reference in New Issue
Block a user