Use expectPlugin

This commit is contained in:
Daniel Tschinder 2017-08-20 12:54:41 +02:00 committed by Henry Zhu
parent 96bd271495
commit 19c099d116
6 changed files with 8 additions and 7 deletions

View File

@ -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");
}

View File

@ -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)"
}

View File

@ -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)"
}

View File

@ -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": []
}

View File

@ -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": []
}

View File

@ -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)"
}