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:
Nicolò Ribaudo
2017-12-06 06:46:54 +01:00
committed by GitHub
parent e270fbe7f0
commit 509dbb7302
66 changed files with 536 additions and 84 deletions

View File

@@ -0,0 +1,12 @@
class Bar {
test() {}
}
class Foo extends Bar {
constructor() {
const t = () => super.test()
super();
}
}
new Foo();

View File

@@ -8,7 +8,7 @@ function (_Bar) {
babelHelpers.classCallCheck(this, Foo);
var t = () => babelHelpers.get(Foo.prototype.__proto__ || Object.getPrototypeOf(Foo.prototype), "test", _this).call(_this);
var t = () => babelHelpers.get(Foo.prototype.__proto__ || Object.getPrototypeOf(Foo.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(_this);
return _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
}