Reorganize tests; camelCase plugin name
This commit is contained in:
parent
b5e23835ce
commit
38c417e971
@ -62,8 +62,8 @@ function getParserClass(pluginsFromOptions: $ReadOnlyArray<string>): Class<Parse
|
||||
pluginList.unshift("estree");
|
||||
}
|
||||
|
||||
if (pluginList.indexOf("decorators") >= 0 && pluginList.indexOf("decorators-stage-2") >= 0) {
|
||||
throw new Error("Cannot use decorators and decorators-stage-2 plugin together");
|
||||
if (pluginList.indexOf("decorators") >= 0 && pluginList.indexOf("decoratorsStage2") >= 0) {
|
||||
throw new Error("Cannot use decorators and decoratorsStage2 plugin together");
|
||||
}
|
||||
|
||||
const key = pluginList.join("/");
|
||||
|
||||
@ -848,8 +848,8 @@ export default class ExpressionParser extends LValParser {
|
||||
}
|
||||
|
||||
if (this.match(tt.at)) {
|
||||
if (this.hasPlugin("decorators-stage-2")) {
|
||||
this.raise(this.state.start, "decorators-stage-2 disallows object literal property decorators");
|
||||
if (this.hasPlugin("decoratorsStage2")) {
|
||||
this.raise(this.state.start, "Stage 2 decorators disallow 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
|
||||
|
||||
@ -187,7 +187,7 @@ export default class LValParser extends NodeUtils {
|
||||
break;
|
||||
} else {
|
||||
const decorators = [];
|
||||
if (this.match(tt.at) && this.hasPlugin("decorators-stage-2")) {
|
||||
if (this.match(tt.at) && this.hasPlugin("decoratorsStage2")) {
|
||||
this.raise(this.state.start, "Stage 2 decorators cannot be used to decorate parameters");
|
||||
}
|
||||
while (this.match(tt.at)) {
|
||||
|
||||
@ -157,7 +157,7 @@ export default class StatementParser extends ExpressionParser {
|
||||
}
|
||||
|
||||
parseDecorators(allowExport?: boolean): void {
|
||||
if (this.hasPlugin("decorators-stage-2")) {
|
||||
if (this.hasPlugin("decoratorsStage2")) {
|
||||
allowExport = false;
|
||||
}
|
||||
|
||||
@ -176,14 +176,14 @@ export default class StatementParser extends ExpressionParser {
|
||||
}
|
||||
|
||||
parseDecorator(): N.Decorator {
|
||||
if (!(this.hasPlugin("decorators") || this.hasPlugin("decorators-stage-2"))) {
|
||||
if (!(this.hasPlugin("decorators") || this.hasPlugin("decoratorsStage2"))) {
|
||||
this.unexpected();
|
||||
}
|
||||
|
||||
const node = this.startNode();
|
||||
this.next();
|
||||
|
||||
if (this.hasPlugin("decorators-stage-2")) {
|
||||
if (this.hasPlugin("decoratorsStage2")) {
|
||||
const startPos = this.state.start;
|
||||
const startLoc = this.state.startLoc;
|
||||
let expr = this.parseIdentifier(false);
|
||||
@ -714,7 +714,7 @@ export default class StatementParser extends ExpressionParser {
|
||||
|
||||
this.parseClassMember(classBody, member, state);
|
||||
|
||||
if (this.hasPlugin("decorators-stage-2") && member.kind != "method" && member.decorators && member.decorators.length > 0) {
|
||||
if (this.hasPlugin("decoratorsStage2") && member.kind != "method" && member.decorators && member.decorators.length > 0) {
|
||||
this.raise(member.start, "Stage 2 decorators may only be used with a class or a class method");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"plugins": ["decorators-stage-2", "classProperties"],
|
||||
"plugins": ["decoratorsStage2", "classProperties"],
|
||||
"throws": "Unexpected token (2:12)"
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"plugins": ["decorators-stage-2", "classProperties"],
|
||||
"plugins": ["decoratorsStage2", "classProperties"],
|
||||
"throws": "Stage 2 decorators may only be used with a class or a class method (2:6)"
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"plugins": ["classProperties", "decorators-stage-2"],
|
||||
"plugins": ["classProperties", "decoratorsStage2"],
|
||||
"throws": "Stage 2 decorators may only be used with a class or a class method (2:7)"
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"plugins": ["decorators-stage-2"]
|
||||
"plugins": ["decoratorsStage2"]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user