diff --git a/src/parser/statement.js b/src/parser/statement.js index 074f8b9177..76b5ffcc57 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -1152,13 +1152,13 @@ export default class StatementParser extends ExpressionParser { parseClassProperty(node: N.ClassProperty): N.ClassProperty { if (!node.typeAnnotation) { - this.expectOnePlugin(["classProperties"]); + this.expectPlugin("classProperties"); } this.state.inClassProperty = true; if (this.match(tt.eq)) { - this.expectOnePlugin(["classProperties"]); + this.expectPlugin("classProperties"); this.next(); node.value = this.parseMaybeAssign(); } else { @@ -1166,6 +1166,7 @@ export default class StatementParser extends ExpressionParser { } this.semicolon(); this.state.inClassProperty = false; + return this.finishNode(node, "ClassProperty"); } diff --git a/test/fixtures/es2017/async-functions/no-method-asi/options.json b/test/fixtures/es2017/async-functions/no-method-asi/options.json index 50015cce4f..7348c12f9e 100644 --- a/test/fixtures/es2017/async-functions/no-method-asi/options.json +++ b/test/fixtures/es2017/async-functions/no-method-asi/options.json @@ -1,3 +1,3 @@ { - "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'classProperties' (3:2)" + "throws": "This experimental syntax requires enabling the parser plugin: 'classProperties' (3:2)" } diff --git a/test/fixtures/experimental/_no-plugin/class-properties-with-initializer-and-type/options.json b/test/fixtures/experimental/_no-plugin/class-properties-with-initializer-and-type/options.json index 377b10b6f5..a4e85bf033 100644 --- a/test/fixtures/experimental/_no-plugin/class-properties-with-initializer-and-type/options.json +++ b/test/fixtures/experimental/_no-plugin/class-properties-with-initializer-and-type/options.json @@ -1,4 +1,4 @@ { "plugins": ["flow"], - "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'classProperties' (2:14)" + "throws": "This experimental syntax requires enabling the parser plugin: 'classProperties' (2:14)" } diff --git a/test/fixtures/experimental/_no-plugin/class-properties-with-initializer/options.json b/test/fixtures/experimental/_no-plugin/class-properties-with-initializer/options.json index bb4a037619..aaa6e80686 100644 --- a/test/fixtures/experimental/_no-plugin/class-properties-with-initializer/options.json +++ b/test/fixtures/experimental/_no-plugin/class-properties-with-initializer/options.json @@ -1,4 +1,4 @@ { - "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'classProperties' (2:6)", + "throws": "This experimental syntax requires enabling the parser plugin: 'classProperties' (2:6)", "plugins": [] } diff --git a/test/fixtures/experimental/_no-plugin/class-properties-without-initializer/options.json b/test/fixtures/experimental/_no-plugin/class-properties-without-initializer/options.json index 5858f49010..bbec0b1850 100644 --- a/test/fixtures/experimental/_no-plugin/class-properties-without-initializer/options.json +++ b/test/fixtures/experimental/_no-plugin/class-properties-without-initializer/options.json @@ -1,4 +1,4 @@ { - "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'classProperties' (2:5)", + "throws": "This experimental syntax requires enabling the parser plugin: 'classProperties' (2:5)", "plugins": [] } diff --git a/test/fixtures/experimental/async-generators/class-method-no-asi/options.json b/test/fixtures/experimental/async-generators/class-method-no-asi/options.json index 50015cce4f..7348c12f9e 100644 --- a/test/fixtures/experimental/async-generators/class-method-no-asi/options.json +++ b/test/fixtures/experimental/async-generators/class-method-no-asi/options.json @@ -1,3 +1,3 @@ { - "throws": "This experimental syntax requires enabling one of the following parser plugin(s): 'classProperties' (3:2)" + "throws": "This experimental syntax requires enabling the parser plugin: 'classProperties' (3:2)" }