rename decoratorsStage2 -> decorators2

This commit is contained in:
Peeyush Kushwaha 2017-06-22 02:00:36 +05:30
parent e1972baff5
commit e5fdb3448d
10 changed files with 17 additions and 17 deletions

View File

@ -48,8 +48,8 @@ const parserClassCache: { [key: string]: Class<Parser> } = {};
/** Get a Parser class with plugins applied. */
function getParserClass(pluginsFromOptions: $ReadOnlyArray<string>): Class<Parser> {
if (pluginsFromOptions.indexOf("decorators") >= 0 && pluginsFromOptions.indexOf("decoratorsStage2") >= 0) {
throw new Error("Cannot use decorators and decoratorsStage2 plugin together");
if (pluginsFromOptions.indexOf("decorators") >= 0 && pluginsFromOptions.indexOf("decorators2") >= 0) {
throw new Error("Cannot use decorators and decorators2 plugin together");
}
// Filter out just the plugins that have an actual mixin associated with them.

View File

@ -858,7 +858,7 @@ export default class ExpressionParser extends LValParser {
}
if (this.match(tt.at)) {
if (this.hasPlugin("decoratorsStage2")) {
if (this.hasPlugin("decorators2")) {
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

View File

@ -187,7 +187,7 @@ export default class LValParser extends NodeUtils {
break;
} else {
const decorators = [];
if (this.match(tt.at) && this.hasPlugin("decoratorsStage2")) {
if (this.match(tt.at) && this.hasPlugin("decorators2")) {
this.raise(this.state.start, "Stage 2 decorators cannot be used to decorate parameters");
}
while (this.match(tt.at)) {

View File

@ -152,7 +152,7 @@ export default class StatementParser extends ExpressionParser {
takeDecorators(node: N.HasDecorators): void {
if (this.state.decorators.length) {
node.decorators = this.state.decorators;
if (this.hasPlugin("decoratorsStage2")) {
if (this.hasPlugin("decorators2")) {
this.resetStartLocationFromNode(node, this.state.decorators[0]);
}
this.state.decorators = [];
@ -160,7 +160,7 @@ export default class StatementParser extends ExpressionParser {
}
parseDecorators(allowExport?: boolean): void {
if (this.hasPlugin("decoratorsStage2")) {
if (this.hasPlugin("decorators2")) {
allowExport = false;
}
@ -179,14 +179,14 @@ export default class StatementParser extends ExpressionParser {
}
parseDecorator(): N.Decorator {
if (!(this.hasPlugin("decorators") || this.hasPlugin("decoratorsStage2"))) {
if (!(this.hasPlugin("decorators") || this.hasPlugin("decorators2"))) {
this.unexpected();
}
const node = this.startNode();
this.next();
if (this.hasPlugin("decoratorsStage2")) {
if (this.hasPlugin("decorators2")) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
let expr = this.parseIdentifier(false);
@ -712,7 +712,7 @@ export default class StatementParser extends ExpressionParser {
// steal the decorators if there are any
if (decorators.length) {
member.decorators = decorators;
if (this.hasPlugin("decoratorsStage2")) {
if (this.hasPlugin("decorators2")) {
this.resetStartLocationFromNode(member, decorators[0]);
}
decorators = [];
@ -720,7 +720,7 @@ export default class StatementParser extends ExpressionParser {
this.parseClassMember(classBody, member, state);
if (this.hasPlugin("decoratorsStage2") && member.kind != "method" && member.decorators && member.decorators.length > 0) {
if (this.hasPlugin("decorators2") && 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");
}
}

View File

@ -1,4 +1,4 @@
{
"plugins": ["classProperties", "decoratorsStage2"],
"plugins": ["classProperties", "decorators2"],
"throws": "Stage 2 decorators may only be used with a class or a class method (2:2)"
}

View File

@ -1,4 +1,4 @@
{
"plugins": ["decoratorsStage2", "classProperties"],
"plugins": ["decorators2", "classProperties"],
"throws": "Stage 2 decorators may only be used with a class or a class method (2:2)"
}

View File

@ -1,4 +1,4 @@
{
"plugins": ["classProperties", "classPrivateProperties", "decoratorsStage2"],
"plugins": ["classProperties", "classPrivateProperties", "decorators2"],
"throws": "Stage 2 decorators may only be used with a class or a class method (2:2)"
}

View File

@ -1,4 +1,4 @@
{
"plugins": ["classProperties", "decoratorsStage2"],
"plugins": ["classProperties", "decorators2"],
"throws": "Stage 2 decorators may only be used with a class or a class method (2:2)"
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["decoratorsStage2"]
"plugins": ["decorators2"]
}

View File

@ -1,4 +1,4 @@
{
"plugins": ["decorators", "decoratorsStage2"],
"throws": "Cannot use decorators and decoratorsStage2 plugin together"
"plugins": ["decorators", "decorators2"],
"throws": "Cannot use decorators and decorators2 plugin together"
}