Forbid semicolons after decorators in classes (#352)
This commit is contained in:
parent
ad8d520406
commit
561d4f74b0
@ -648,6 +648,9 @@ pp.parseClassBody = function (node) {
|
|||||||
|
|
||||||
while (!this.eat(tt.braceR)) {
|
while (!this.eat(tt.braceR)) {
|
||||||
if (this.eat(tt.semi)) {
|
if (this.eat(tt.semi)) {
|
||||||
|
if (decorators.length > 0) {
|
||||||
|
this.raise(this.state.lastTokEnd, "Decorators must not be followed by a semicolon");
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
test/fixtures/experimental/decorators/no-semi/actual.js
vendored
Normal file
4
test/fixtures/experimental/decorators/no-semi/actual.js
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
class A {
|
||||||
|
@a;
|
||||||
|
m(){}
|
||||||
|
}
|
||||||
3
test/fixtures/experimental/decorators/no-semi/options.json
vendored
Normal file
3
test/fixtures/experimental/decorators/no-semi/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"throws": "Decorators must not be followed by a semicolon (2:5)"
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user