diff --git a/src/parser/expression.js b/src/parser/expression.js index f974459462..5c9ebd588f 100644 --- a/src/parser/expression.js +++ b/src/parser/expression.js @@ -392,7 +392,7 @@ pp.parseExprAtom = function (refShorthandDefaultPos) { this.unexpected(); } if (this.match(tt.parenL) && this.state.inMethod !== "constructor" && !this.options.allowSuperOutsideMethod) { - this.raise(node.start, "super() outside of class constructor"); + this.raise(node.start, "super() is only valid inside a class constructor. Make sure the method name is spelled exactly as 'constructor'."); } return this.finishNode(node, "Super"); diff --git a/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json b/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json index 476bc13a2b..faef53359b 100644 --- a/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json +++ b/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json @@ -1,3 +1,3 @@ { - "throws": "super() outside of class constructor (2:8)" -} \ No newline at end of file + "throws": "super() is only valid inside a class constructor. Make sure the method name is spelled exactly as 'constructor'. (2:8)" +}