Disallow in object literals, params, class props
And add tests to reflect the same
This commit is contained in:
@@ -847,8 +847,16 @@ export default class ExpressionParser extends LValParser {
|
||||
if (this.eat(tt.braceR)) break;
|
||||
}
|
||||
|
||||
while (this.match(tt.at)) {
|
||||
decorators.push(this.parseDecorator());
|
||||
if (this.match(tt.at)) {
|
||||
if (this.hasPlugin("decorators-stage-2")) {
|
||||
this.raise(this.state.start, "decorators-stage-2 disallows object literal property decorators");
|
||||
} else {
|
||||
// we needn't check if decorators (stage 0) plugin is enabled since it's checked by
|
||||
// the call to this.parseDecorator
|
||||
while (this.match(tt.at)) {
|
||||
decorators.push(this.parseDecorator());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let prop = this.startNode(), isGenerator = false, isAsync = false, startPos, startLoc;
|
||||
|
||||
Reference in New Issue
Block a user