Incorporate suggestions from review

This commit is contained in:
Peeyush Kushwaha 2017-06-27 22:46:43 +05:30
parent c3b992e031
commit f2ad94d0e3
2 changed files with 8 additions and 8 deletions

View File

@ -171,13 +171,12 @@ export default class StatementParser extends ExpressionParser {
currentContextDecorators.push(decorator);
}
if (allowExport && this.match(tt._export)) {
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 a decorator and a class is not allowed. Please use `export @dec class` instead");
if (this.match(tt._export)) {
if (allowExport) {
return;
} else {
this.raise(this.state.start, "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead");
}
}
if (!this.match(tt._class)) {

View File

@ -90,7 +90,8 @@ export default class State {
labels: Array<{ kind: ?("loop" | "switch"), statementStart?: number }>;
// Leading decorators. Last element of the stack represents the decorators in current context.
// Supports nesting of decorators, e.g. @foo(@bar class {}) class {}
// Supports nesting of decorators, e.g. @foo(@bar class inner {}) class outer {}
// where @foo belongs to the outer class and @bar to the inner
decoratorStack: Array<Array<N.Decorator>>;
// Token store.