Improves error message when super is called outside of constructor (#408)
This commit is contained in:
parent
0f982799b6
commit
964105e3fb
@ -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");
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "super() outside of class constructor (2:8)"
|
||||
}
|
||||
"throws": "super() is only valid inside a class constructor. Make sure the method name is spelled exactly as 'constructor'. (2:8)"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user