Helpful error message for @dec export class

This commit is contained in:
Peeyush Kushwaha
2017-06-23 02:19:08 +05:30
parent f976bdd21c
commit add8e4ad13
2 changed files with 6 additions and 1 deletions

View File

@@ -173,6 +173,11 @@ export default class StatementParser extends ExpressionParser {
return;
}
// special error for the common case of @dec export class
if (!allowExport && this.match(tt._export)) {
this.raise(this.state.start, "Using the export keyword between decorators and class is disallowed. Please use `export @dec class` instead");
}
if (!this.match(tt._class)) {
this.raise(this.state.start, "Leading decorators must be attached to a class declaration");
}