this before super() is a runtime error, not a static one. (#6467)
* Check that super.* is after super() at runtime * "missing super() call in constructor" runtime * "'this' is not allowed before super()" runtime
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
class Foo extends Bar {
|
||||
constructor() {
|
||||
const t = () => super.test()
|
||||
super();
|
||||
t();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class Bar {
|
||||
test() {}
|
||||
}
|
||||
|
||||
class Foo extends Bar {
|
||||
constructor() {
|
||||
const t = () => super.test()
|
||||
super();
|
||||
t();
|
||||
}
|
||||
}
|
||||
|
||||
new Foo();
|
||||
@@ -0,0 +1,19 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
|
||||
var t = () => babelHelpers.get(Foo.prototype.__proto__ || Object.getPrototypeOf(Foo.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(_this);
|
||||
|
||||
_this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
|
||||
t();
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Foo;
|
||||
}(Bar);
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "transform-classes", "transform-block-scoping"]
|
||||
}
|
||||
Reference in New Issue
Block a user