Improves error message when super is called outside of constructor (#408)
This commit is contained in:
committed by
Henry Zhu
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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user