From c2068d1c57acb610b95764535ffd904a0334f001 Mon Sep 17 00:00:00 2001 From: Diego Date: Sat, 1 Jul 2017 16:23:15 -0700 Subject: [PATCH] Allowing comma separated fields - Fixes #540 - Fixes location for publicFields (should not contain semi-colon) - Allow decorators for comma separated fields - Added tests --- src/parser/statement.js | 29 +- src/tokenizer/state.js | 1 + .../comma-separated/actual.js | 5 + .../comma-separated/expected.json | 372 +++++++++++ .../comma-separated/options.json | 3 + .../delete-non-private/expected.json | 6 +- .../inline/expected.json | 18 +- .../nested/expected.json | 18 +- .../pbn-success/expected.json | 10 +- .../comma-separated/actual.js | 5 + .../comma-separated/expected.json | 386 ++++++++++++ .../comma-separated/options.json | 3 + .../class-properties/edge-cases/expected.json | 10 +- .../class-properties/inline/expected.json | 18 +- .../class-properties/super/expected.json | 6 +- .../expected.json | 6 +- .../uncategorised/43/expected.json | 6 +- .../uncategorised/44/expected.json | 6 +- .../uncategorised/45/expected.json | 6 +- .../uncategorised/46/expected.json | 6 +- .../uncategorised/47/expected.json | 6 +- .../uncategorised/48/expected.json | 6 +- .../experimental/uncategorised/63/actual.js | 10 + .../uncategorised/63/expected.json | 591 ++++++++++++++++++ .../uncategorised/63/options.json | 3 + .../experimental/uncategorised/64/actual.js | 4 + .../uncategorised/64/expected.json | 260 ++++++++ .../uncategorised/64/options.json | 3 + .../expected.json | 6 +- .../flow/type-annotations/53/expected.json | 10 +- .../flow/type-annotations/54/expected.json | 10 +- .../typescript/class/declare/expected.json | 10 +- .../members-with-modifier-names/expected.json | 6 +- .../class/modifiers-properties/expected.json | 66 +- .../typescript/class/properties/expected.json | 18 +- .../class/property-computed/expected.json | 10 +- 36 files changed, 1802 insertions(+), 137 deletions(-) create mode 100644 test/fixtures/experimental/class-private-properties/comma-separated/actual.js create mode 100644 test/fixtures/experimental/class-private-properties/comma-separated/expected.json create mode 100644 test/fixtures/experimental/class-private-properties/comma-separated/options.json create mode 100644 test/fixtures/experimental/class-properties/comma-separated/actual.js create mode 100644 test/fixtures/experimental/class-properties/comma-separated/expected.json create mode 100644 test/fixtures/experimental/class-properties/comma-separated/options.json create mode 100644 test/fixtures/experimental/uncategorised/63/actual.js create mode 100644 test/fixtures/experimental/uncategorised/63/expected.json create mode 100644 test/fixtures/experimental/uncategorised/63/options.json create mode 100644 test/fixtures/experimental/uncategorised/64/actual.js create mode 100644 test/fixtures/experimental/uncategorised/64/expected.json create mode 100644 test/fixtures/experimental/uncategorised/64/options.json diff --git a/src/parser/statement.js b/src/parser/statement.js index 53485072df..35501f2c1b 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -859,6 +859,9 @@ export default class StatementParser extends ExpressionParser { while (!this.eat(tt.braceR)) { if (this.eat(tt.semi)) { + if (this.state.inCommaSeparatedFields) { + this.unexpected(); + } if (decorators.length > 0) { this.raise( this.state.lastTokEnd, @@ -881,10 +884,26 @@ export default class StatementParser extends ExpressionParser { if (this.hasPlugin("decorators2")) { this.resetStartLocationFromNode(member, decorators[0]); } - decorators = []; } this.parseClassMember(classBody, member, state); + const isClassField = member.kind == null; + + if (isClassField) { + if (this.eat(tt.comma)) { + this.state.inCommaSeparatedFields = true; + // Copy decorators for cases like `@foo x, y;` + if (decorators.length) { + member.decorators = decorators; + } + } else { + decorators = []; + this.state.inCommaSeparatedFields = false; + this.semicolon(); + } + } else { + decorators = []; + } if ( this.hasPlugin("decorators2") && @@ -899,7 +918,7 @@ export default class StatementParser extends ExpressionParser { } } - if (decorators.length) { + if (!this.state.inCommaSeparatedFields && decorators.length) { this.raise( this.state.start, "You have trailing decorators with no method", @@ -1071,7 +1090,7 @@ export default class StatementParser extends ExpressionParser { /* isConstructor */ false, ); this.checkGetterSetterParamCount(method); - } else if (this.isLineTerminator()) { + } else if (this.isLineTerminator() || this.match(tt.comma)) { // an uninitialized class property (due to ASI, since we don't otherwise recognize the next token) if (this.isNonstaticConstructor(prop)) { this.raise( @@ -1135,7 +1154,7 @@ export default class StatementParser extends ExpressionParser { } else { node.value = null; } - this.semicolon(); + this.state.inClassProperty = false; return this.finishNode(node, "ClassPrivateProperty"); } @@ -1158,7 +1177,7 @@ export default class StatementParser extends ExpressionParser { } else { node.value = null; } - this.semicolon(); + this.state.inClassProperty = false; return this.finishNode(node, "ClassProperty"); } diff --git a/src/tokenizer/state.js b/src/tokenizer/state.js index d286710927..b17c78c44f 100644 --- a/src/tokenizer/state.js +++ b/src/tokenizer/state.js @@ -80,6 +80,7 @@ export default class State { // Check whether we are in a (nested) class or not. classLevel: number; + inCommaSeparatedFields: boolean; // Labels in scope. labels: Array<{ kind: ?("loop" | "switch"), statementStart?: number }>; diff --git a/test/fixtures/experimental/class-private-properties/comma-separated/actual.js b/test/fixtures/experimental/class-private-properties/comma-separated/actual.js new file mode 100644 index 0000000000..6d913a05d4 --- /dev/null +++ b/test/fixtures/experimental/class-private-properties/comma-separated/actual.js @@ -0,0 +1,5 @@ +class C { + #p1,#p2; + #p3 = 1, #p4 = 1; + #p5 = 1, #p6, #p7; +} diff --git a/test/fixtures/experimental/class-private-properties/comma-separated/expected.json b/test/fixtures/experimental/class-private-properties/comma-separated/expected.json new file mode 100644 index 0000000000..691bdc7857 --- /dev/null +++ b/test/fixtures/experimental/class-private-properties/comma-separated/expected.json @@ -0,0 +1,372 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 15, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "start": 13, + "end": 15, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "p1" + }, + "name": "p1" + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "key": { + "type": "Identifier", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "p2" + }, + "name": "p2" + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 23, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "key": { + "type": "Identifier", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "p3" + }, + "name": "p3" + }, + "value": { + "type": "NumericLiteral", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassPrivateProperty", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "key": { + "type": "Identifier", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + }, + "identifierName": "p4" + }, + "name": "p4" + }, + "value": { + "type": "NumericLiteral", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassPrivateProperty", + "start": 43, + "end": 50, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "key": { + "type": "Identifier", + "start": 44, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 5 + }, + "identifierName": "p5" + }, + "name": "p5" + }, + "value": { + "type": "NumericLiteral", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassPrivateProperty", + "start": 52, + "end": 55, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "key": { + "type": "Identifier", + "start": 53, + "end": 55, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 14 + }, + "identifierName": "p6" + }, + "name": "p6" + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 57, + "end": 60, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "key": { + "type": "Identifier", + "start": 58, + "end": 60, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 19 + }, + "identifierName": "p7" + }, + "name": "p7" + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} diff --git a/test/fixtures/experimental/class-private-properties/comma-separated/options.json b/test/fixtures/experimental/class-private-properties/comma-separated/options.json new file mode 100644 index 0000000000..19c38d2996 --- /dev/null +++ b/test/fixtures/experimental/class-private-properties/comma-separated/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties", "classPrivateProperties"] +} diff --git a/test/fixtures/experimental/class-private-properties/delete-non-private/expected.json b/test/fixtures/experimental/class-private-properties/delete-non-private/expected.json index bc00bb10ad..a20cb99843 100644 --- a/test/fixtures/experimental/class-private-properties/delete-non-private/expected.json +++ b/test/fixtures/experimental/class-private-properties/delete-non-private/expected.json @@ -78,7 +78,7 @@ { "type": "ClassPrivateProperty", "start": 14, - "end": 17, + "end": 16, "loc": { "start": { "line": 2, @@ -86,7 +86,7 @@ }, "end": { "line": 2, - "column": 5 + "column": 4 } }, "key": { @@ -272,4 +272,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/class-private-properties/inline/expected.json b/test/fixtures/experimental/class-private-properties/inline/expected.json index 79e5aa820a..87772b02e0 100644 --- a/test/fixtures/experimental/class-private-properties/inline/expected.json +++ b/test/fixtures/experimental/class-private-properties/inline/expected.json @@ -78,7 +78,7 @@ { "type": "ClassPrivateProperty", "start": 10, - "end": 13, + "end": 12, "loc": { "start": { "line": 1, @@ -86,7 +86,7 @@ }, "end": { "line": 1, - "column": 13 + "column": 12 } }, "key": { @@ -111,7 +111,7 @@ { "type": "ClassPrivateProperty", "start": 14, - "end": 17, + "end": 16, "loc": { "start": { "line": 1, @@ -119,7 +119,7 @@ }, "end": { "line": 1, - "column": 17 + "column": 16 } }, "key": { @@ -194,7 +194,7 @@ { "type": "ClassPrivateProperty", "start": 31, - "end": 38, + "end": 37, "loc": { "start": { "line": 3, @@ -202,7 +202,7 @@ }, "end": { "line": 3, - "column": 17 + "column": 16 } }, "key": { @@ -246,7 +246,7 @@ { "type": "ClassPrivateProperty", "start": 39, - "end": 46, + "end": 45, "loc": { "start": { "line": 3, @@ -254,7 +254,7 @@ }, "end": { "line": 3, - "column": 25 + "column": 24 } }, "key": { @@ -301,4 +301,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/class-private-properties/nested/expected.json b/test/fixtures/experimental/class-private-properties/nested/expected.json index 30bd320359..4c24f26dad 100644 --- a/test/fixtures/experimental/class-private-properties/nested/expected.json +++ b/test/fixtures/experimental/class-private-properties/nested/expected.json @@ -78,7 +78,7 @@ { "type": "ClassPrivateProperty", "start": 18, - "end": 25, + "end": 24, "loc": { "start": { "line": 2, @@ -86,7 +86,7 @@ }, "end": { "line": 2, - "column": 11 + "column": 10 } }, "key": { @@ -130,7 +130,7 @@ { "type": "ClassPrivateProperty", "start": 30, - "end": 37, + "end": 36, "loc": { "start": { "line": 3, @@ -138,7 +138,7 @@ }, "end": { "line": 3, - "column": 11 + "column": 10 } }, "key": { @@ -649,7 +649,7 @@ { "type": "ClassPrivateProperty", "start": 146, - "end": 153, + "end": 152, "loc": { "start": { "line": 11, @@ -657,7 +657,7 @@ }, "end": { "line": 11, - "column": 19 + "column": 18 } }, "key": { @@ -701,7 +701,7 @@ { "type": "ClassPrivateProperty", "start": 166, - "end": 173, + "end": 172, "loc": { "start": { "line": 12, @@ -709,7 +709,7 @@ }, "end": { "line": 12, - "column": 19 + "column": 18 } }, "key": { @@ -3350,4 +3350,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/class-private-properties/pbn-success/expected.json b/test/fixtures/experimental/class-private-properties/pbn-success/expected.json index b8a4aa6558..7c04c1dcfa 100644 --- a/test/fixtures/experimental/class-private-properties/pbn-success/expected.json +++ b/test/fixtures/experimental/class-private-properties/pbn-success/expected.json @@ -78,7 +78,7 @@ { "type": "ClassPrivateProperty", "start": 18, - "end": 21, + "end": 20, "loc": { "start": { "line": 2, @@ -86,7 +86,7 @@ }, "end": { "line": 2, - "column": 7 + "column": 6 } }, "key": { @@ -111,7 +111,7 @@ { "type": "ClassPrivateProperty", "start": 26, - "end": 29, + "end": 28, "loc": { "start": { "line": 3, @@ -119,7 +119,7 @@ }, "end": { "line": 3, - "column": 7 + "column": 6 } }, "key": { @@ -1621,4 +1621,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/class-properties/comma-separated/actual.js b/test/fixtures/experimental/class-properties/comma-separated/actual.js new file mode 100644 index 0000000000..0f36fe2b64 --- /dev/null +++ b/test/fixtures/experimental/class-properties/comma-separated/actual.js @@ -0,0 +1,5 @@ +class C { + p1, p2; + p3 = 1, p4 = 1; + p5 = 1, p6, p7; +} diff --git a/test/fixtures/experimental/class-properties/comma-separated/expected.json b/test/fixtures/experimental/class-properties/comma-separated/expected.json new file mode 100644 index 0000000000..bc1f46cfca --- /dev/null +++ b/test/fixtures/experimental/class-properties/comma-separated/expected.json @@ -0,0 +1,386 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "p1" + }, + "name": "p1" + }, + "value": null + }, + { + "type": "ClassProperty", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "p2" + }, + "name": "p2" + }, + "value": null + }, + { + "type": "ClassProperty", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "p3" + }, + "name": "p3" + }, + "value": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassProperty", + "start": 30, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 12 + }, + "identifierName": "p4" + }, + "name": "p4" + }, + "value": { + "type": "NumericLiteral", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassProperty", + "start": 40, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 8 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 4 + }, + "identifierName": "p5" + }, + "name": "p5" + }, + "value": { + "type": "NumericLiteral", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassProperty", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 12 + }, + "identifierName": "p6" + }, + "name": "p6" + }, + "value": null + }, + { + "type": "ClassProperty", + "start": 52, + "end": 54, + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 52, + "end": 54, + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 16 + }, + "identifierName": "p7" + }, + "name": "p7" + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} diff --git a/test/fixtures/experimental/class-properties/comma-separated/options.json b/test/fixtures/experimental/class-properties/comma-separated/options.json new file mode 100644 index 0000000000..19c38d2996 --- /dev/null +++ b/test/fixtures/experimental/class-properties/comma-separated/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties", "classPrivateProperties"] +} diff --git a/test/fixtures/experimental/class-properties/edge-cases/expected.json b/test/fixtures/experimental/class-properties/edge-cases/expected.json index e029628a70..2eb1938eda 100644 --- a/test/fixtures/experimental/class-properties/edge-cases/expected.json +++ b/test/fixtures/experimental/class-properties/edge-cases/expected.json @@ -1134,7 +1134,7 @@ { "type": "ClassProperty", "start": 264, - "end": 271, + "end": 270, "loc": { "start": { "line": 34, @@ -1142,7 +1142,7 @@ }, "end": { "line": 34, - "column": 19 + "column": 18 } }, "static": false, @@ -1219,7 +1219,7 @@ { "type": "ClassProperty", "start": 289, - "end": 300, + "end": 299, "loc": { "start": { "line": 37, @@ -1227,7 +1227,7 @@ }, "end": { "line": 37, - "column": 13 + "column": 12 } }, "static": false, @@ -1493,4 +1493,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/class-properties/inline/expected.json b/test/fixtures/experimental/class-properties/inline/expected.json index d5369121bb..fcd221bd89 100644 --- a/test/fixtures/experimental/class-properties/inline/expected.json +++ b/test/fixtures/experimental/class-properties/inline/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 10, - "end": 12, + "end": 11, "loc": { "start": { "line": 1, @@ -86,7 +86,7 @@ }, "end": { "line": 1, - "column": 12 + "column": 11 } }, "static": false, @@ -113,7 +113,7 @@ { "type": "ClassProperty", "start": 13, - "end": 15, + "end": 14, "loc": { "start": { "line": 1, @@ -121,7 +121,7 @@ }, "end": { "line": 1, - "column": 15 + "column": 14 } }, "static": false, @@ -198,7 +198,7 @@ { "type": "ClassProperty", "start": 29, - "end": 35, + "end": 34, "loc": { "start": { "line": 3, @@ -206,7 +206,7 @@ }, "end": { "line": 3, - "column": 16 + "column": 15 } }, "static": false, @@ -252,7 +252,7 @@ { "type": "ClassProperty", "start": 36, - "end": 42, + "end": 41, "loc": { "start": { "line": 3, @@ -260,7 +260,7 @@ }, "end": { "line": 3, - "column": 23 + "column": 22 } }, "static": false, @@ -309,4 +309,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/class-properties/super/expected.json b/test/fixtures/experimental/class-properties/super/expected.json index 3460702b3b..abed66fb5d 100644 --- a/test/fixtures/experimental/class-properties/super/expected.json +++ b/test/fixtures/experimental/class-properties/super/expected.json @@ -168,7 +168,7 @@ { "type": "ClassProperty", "start": 40, - "end": 54, + "end": 53, "loc": { "start": { "line": 2, @@ -176,7 +176,7 @@ }, "end": { "line": 2, - "column": 16 + "column": 15 } }, "static": false, @@ -269,4 +269,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/decorators/computed-member-expr-on-prop/expected.json b/test/fixtures/experimental/decorators/computed-member-expr-on-prop/expected.json index 16385a68fc..c8365f5a02 100644 --- a/test/fixtures/experimental/decorators/computed-member-expr-on-prop/expected.json +++ b/test/fixtures/experimental/decorators/computed-member-expr-on-prop/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 24, - "end": 30, + "end": 29, "loc": { "start": { "line": 2, @@ -86,7 +86,7 @@ }, "end": { "line": 2, - "column": 18 + "column": 17 } }, "decorators": [ @@ -202,4 +202,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/uncategorised/43/expected.json b/test/fixtures/experimental/uncategorised/43/expected.json index b5e0eed1ee..b5495c577d 100644 --- a/test/fixtures/experimental/uncategorised/43/expected.json +++ b/test/fixtures/experimental/uncategorised/43/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 12, - "end": 24, + "end": 23, "loc": { "start": { "line": 1, @@ -86,7 +86,7 @@ }, "end": { "line": 1, - "column": 24 + "column": 23 } }, "static": false, @@ -135,4 +135,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/uncategorised/44/expected.json b/test/fixtures/experimental/uncategorised/44/expected.json index 0bd96ae88c..717c1a120d 100644 --- a/test/fixtures/experimental/uncategorised/44/expected.json +++ b/test/fixtures/experimental/uncategorised/44/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 12, - "end": 16, + "end": 15, "loc": { "start": { "line": 1, @@ -86,7 +86,7 @@ }, "end": { "line": 1, - "column": 16 + "column": 15 } }, "static": false, @@ -116,4 +116,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/uncategorised/45/expected.json b/test/fixtures/experimental/uncategorised/45/expected.json index 9c603e0ed1..111ed2489a 100644 --- a/test/fixtures/experimental/uncategorised/45/expected.json +++ b/test/fixtures/experimental/uncategorised/45/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 12, - "end": 23, + "end": 22, "loc": { "start": { "line": 1, @@ -86,7 +86,7 @@ }, "end": { "line": 1, - "column": 23 + "column": 22 } }, "static": true, @@ -116,4 +116,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/uncategorised/46/expected.json b/test/fixtures/experimental/uncategorised/46/expected.json index 221e6c8c0a..d37823787d 100644 --- a/test/fixtures/experimental/uncategorised/46/expected.json +++ b/test/fixtures/experimental/uncategorised/46/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 12, - "end": 31, + "end": 30, "loc": { "start": { "line": 1, @@ -86,7 +86,7 @@ }, "end": { "line": 1, - "column": 31 + "column": 30 } }, "static": true, @@ -135,4 +135,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/uncategorised/47/expected.json b/test/fixtures/experimental/uncategorised/47/expected.json index d638426ba2..6ddd86a080 100644 --- a/test/fixtures/experimental/uncategorised/47/expected.json +++ b/test/fixtures/experimental/uncategorised/47/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 17, - "end": 29, + "end": 28, "loc": { "start": { "line": 1, @@ -86,7 +86,7 @@ }, "end": { "line": 1, - "column": 29 + "column": 28 } }, "decorators": [ @@ -169,4 +169,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/uncategorised/48/expected.json b/test/fixtures/experimental/uncategorised/48/expected.json index 2dfeed15ab..628f2e1cbf 100644 --- a/test/fixtures/experimental/uncategorised/48/expected.json +++ b/test/fixtures/experimental/uncategorised/48/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 17, - "end": 36, + "end": 35, "loc": { "start": { "line": 1, @@ -86,7 +86,7 @@ }, "end": { "line": 1, - "column": 36 + "column": 35 } }, "decorators": [ @@ -169,4 +169,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/experimental/uncategorised/63/actual.js b/test/fixtures/experimental/uncategorised/63/actual.js new file mode 100644 index 0000000000..f89ad41cd7 --- /dev/null +++ b/test/fixtures/experimental/uncategorised/63/actual.js @@ -0,0 +1,10 @@ +class C { + static x = 1, #y, [a]; + z, #w = 2, [b]; + + a() { + this.z; + this.#w++; + #w; + } +} diff --git a/test/fixtures/experimental/uncategorised/63/expected.json b/test/fixtures/experimental/uncategorised/63/expected.json new file mode 100644 index 0000000000..375dfa2db7 --- /dev/null +++ b/test/fixtures/experimental/uncategorised/63/expected.json @@ -0,0 +1,591 @@ +{ + "type": "File", + "start": 0, + "end": 102, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 102, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 102, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 102, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 10, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "static": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "value": { + "type": "NumericLiteral", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassPrivateProperty", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "key": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "y" + }, + "name": "y" + }, + "value": null + }, + { + "type": "ClassProperty", + "start": 30, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "static": false, + "computed": true, + "key": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + }, + "identifierName": "a" + }, + "name": "a" + }, + "value": null + }, + { + "type": "ClassProperty", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "z" + }, + "name": "z" + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 40, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "key": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "w" + }, + "name": "w" + }, + "value": { + "type": "NumericLiteral", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + }, + { + "type": "ClassProperty", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": false, + "computed": true, + "key": { + "type": "Identifier", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "b" + }, + "name": "b" + }, + "value": null + }, + { + "type": "ClassMethod", + "start": 56, + "end": 100, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 56, + "end": 57, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "kind": "method", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 60, + "end": 100, + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 9, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 66, + "end": 73, + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "expression": { + "type": "MemberExpression", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 10 + } + }, + "object": { + "type": "ThisExpression", + "start": 66, + "end": 70, + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "start": 71, + "end": 72, + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + }, + "identifierName": "z" + }, + "name": "z" + }, + "computed": false + } + }, + { + "type": "ExpressionStatement", + "start": 78, + "end": 88, + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 14 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 78, + "end": 87, + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 13 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "MemberExpression", + "start": 78, + "end": 85, + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 11 + } + }, + "object": { + "type": "ThisExpression", + "start": 78, + "end": 82, + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "property": { + "type": "PrivateName", + "start": 84, + "end": 85, + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + }, + "name": { + "type": "Identifier", + "start": 84, + "end": 85, + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + }, + "identifierName": "w" + }, + "name": "w" + } + }, + "computed": false + } + } + }, + { + "type": "ExpressionStatement", + "start": 93, + "end": 96, + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "expression": { + "type": "PrivateName", + "start": 94, + "end": 95, + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 6 + } + }, + "name": { + "type": "Identifier", + "start": 94, + "end": 95, + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 6 + }, + "identifierName": "w" + }, + "name": "w" + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} diff --git a/test/fixtures/experimental/uncategorised/63/options.json b/test/fixtures/experimental/uncategorised/63/options.json new file mode 100644 index 0000000000..19c38d2996 --- /dev/null +++ b/test/fixtures/experimental/uncategorised/63/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties", "classPrivateProperties"] +} diff --git a/test/fixtures/experimental/uncategorised/64/actual.js b/test/fixtures/experimental/uncategorised/64/actual.js new file mode 100644 index 0000000000..dc1a80a91f --- /dev/null +++ b/test/fixtures/experimental/uncategorised/64/actual.js @@ -0,0 +1,4 @@ +class C { + @api + foo = 1, bar = 1; +} diff --git a/test/fixtures/experimental/uncategorised/64/expected.json b/test/fixtures/experimental/uncategorised/64/expected.json new file mode 100644 index 0000000000..151f30f117 --- /dev/null +++ b/test/fixtures/experimental/uncategorised/64/expected.json @@ -0,0 +1,260 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 19, + "end": 26, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "api" + }, + "name": "api" + } + } + ], + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "value": { + "type": "NumericLiteral", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassProperty", + "start": 28, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "api" + }, + "name": "api" + } + } + ], + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 14 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "value": { + "type": "NumericLiteral", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ] + } + } + ], + "directives": [] + } +} diff --git a/test/fixtures/experimental/uncategorised/64/options.json b/test/fixtures/experimental/uncategorised/64/options.json new file mode 100644 index 0000000000..474bcfdeec --- /dev/null +++ b/test/fixtures/experimental/uncategorised/64/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["decorators", "classPrivateProperties", "classProperties"] +} diff --git a/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/expected.json b/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/expected.json index 721399cff9..15b0d59ab3 100644 --- a/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/expected.json +++ b/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 14, - "end": 38, + "end": 37, "loc": { "start": { "line": 2, @@ -86,7 +86,7 @@ }, "end": { "line": 2, - "column": 26 + "column": 25 } }, "static": false, @@ -166,4 +166,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/flow/type-annotations/53/expected.json b/test/fixtures/flow/type-annotations/53/expected.json index c07a57c007..b5bca3bc94 100644 --- a/test/fixtures/flow/type-annotations/53/expected.json +++ b/test/fixtures/flow/type-annotations/53/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 12, - "end": 25, + "end": 24, "loc": { "start": { "line": 1, @@ -86,7 +86,7 @@ }, "end": { "line": 1, - "column": 25 + "column": 24 } }, "static": false, @@ -144,7 +144,7 @@ { "type": "ClassProperty", "start": 26, - "end": 39, + "end": 38, "loc": { "start": { "line": 1, @@ -152,7 +152,7 @@ }, "end": { "line": 1, - "column": 39 + "column": 38 } }, "static": false, @@ -213,4 +213,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/flow/type-annotations/54/expected.json b/test/fixtures/flow/type-annotations/54/expected.json index 4090718b15..fe6c5c63b1 100644 --- a/test/fixtures/flow/type-annotations/54/expected.json +++ b/test/fixtures/flow/type-annotations/54/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 12, - "end": 32, + "end": 31, "loc": { "start": { "line": 1, @@ -86,7 +86,7 @@ }, "end": { "line": 1, - "column": 32 + "column": 31 } }, "static": true, @@ -144,7 +144,7 @@ { "type": "ClassProperty", "start": 33, - "end": 46, + "end": 45, "loc": { "start": { "line": 1, @@ -152,7 +152,7 @@ }, "end": { "line": 1, - "column": 46 + "column": 45 } }, "static": false, @@ -213,4 +213,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/typescript/class/declare/expected.json b/test/fixtures/typescript/class/declare/expected.json index ef56cc4a7c..4e834ae42c 100644 --- a/test/fixtures/typescript/class/declare/expected.json +++ b/test/fixtures/typescript/class/declare/expected.json @@ -172,7 +172,7 @@ { "type": "ClassProperty", "start": 44, - "end": 46, + "end": 45, "loc": { "start": { "line": 3, @@ -180,7 +180,7 @@ }, "end": { "line": 3, - "column": 6 + "column": 5 } }, "static": false, @@ -207,7 +207,7 @@ { "type": "ClassProperty", "start": 51, - "end": 61, + "end": 60, "loc": { "start": { "line": 4, @@ -215,7 +215,7 @@ }, "end": { "line": 4, - "column": 14 + "column": 13 } }, "static": false, @@ -386,4 +386,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/typescript/class/members-with-modifier-names/expected.json b/test/fixtures/typescript/class/members-with-modifier-names/expected.json index e61ec54c61..c0b84b63ff 100644 --- a/test/fixtures/typescript/class/members-with-modifier-names/expected.json +++ b/test/fixtures/typescript/class/members-with-modifier-names/expected.json @@ -219,7 +219,7 @@ { "type": "ClassProperty", "start": 61, - "end": 74, + "end": 73, "loc": { "start": { "line": 4, @@ -227,7 +227,7 @@ }, "end": { "line": 4, - "column": 17 + "column": 16 } }, "static": false, @@ -379,4 +379,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/typescript/class/modifiers-properties/expected.json b/test/fixtures/typescript/class/modifiers-properties/expected.json index ebdc3a5bcd..057af832c5 100644 --- a/test/fixtures/typescript/class/modifiers-properties/expected.json +++ b/test/fixtures/typescript/class/modifiers-properties/expected.json @@ -79,7 +79,7 @@ { "type": "ClassProperty", "start": 23, - "end": 34, + "end": 33, "loc": { "start": { "line": 2, @@ -87,7 +87,7 @@ }, "end": { "line": 2, - "column": 15 + "column": 14 } }, "readonly": true, @@ -115,7 +115,7 @@ { "type": "ClassProperty", "start": 39, - "end": 60, + "end": 59, "loc": { "start": { "line": 3, @@ -123,7 +123,7 @@ }, "end": { "line": 3, - "column": 25 + "column": 24 } }, "readonly": true, @@ -182,7 +182,7 @@ { "type": "ClassProperty", "start": 65, - "end": 76, + "end": 75, "loc": { "start": { "line": 4, @@ -190,7 +190,7 @@ }, "end": { "line": 4, - "column": 15 + "column": 14 } }, "abstract": true, @@ -218,7 +218,7 @@ { "type": "ClassProperty", "start": 81, - "end": 90, + "end": 89, "loc": { "start": { "line": 5, @@ -226,7 +226,7 @@ }, "end": { "line": 5, - "column": 13 + "column": 12 } }, "static": true, @@ -253,7 +253,7 @@ { "type": "ClassProperty", "start": 96, - "end": 106, + "end": 105, "loc": { "start": { "line": 7, @@ -261,7 +261,7 @@ }, "end": { "line": 7, - "column": 14 + "column": 13 } }, "accessibility": "public", @@ -289,7 +289,7 @@ { "type": "ClassProperty", "start": 111, - "end": 124, + "end": 123, "loc": { "start": { "line": 8, @@ -297,7 +297,7 @@ }, "end": { "line": 8, - "column": 17 + "column": 16 } }, "accessibility": "protected", @@ -325,7 +325,7 @@ { "type": "ClassProperty", "start": 129, - "end": 140, + "end": 139, "loc": { "start": { "line": 9, @@ -333,7 +333,7 @@ }, "end": { "line": 9, - "column": 15 + "column": 14 } }, "accessibility": "private", @@ -361,7 +361,7 @@ { "type": "ClassProperty", "start": 146, - "end": 167, + "end": 166, "loc": { "start": { "line": 11, @@ -369,7 +369,7 @@ }, "end": { "line": 11, - "column": 25 + "column": 24 } }, "abstract": true, @@ -398,7 +398,7 @@ { "type": "ClassProperty", "start": 172, - "end": 193, + "end": 192, "loc": { "start": { "line": 12, @@ -406,7 +406,7 @@ }, "end": { "line": 12, - "column": 25 + "column": 24 } }, "abstract": true, @@ -435,7 +435,7 @@ { "type": "ClassProperty", "start": 198, - "end": 217, + "end": 216, "loc": { "start": { "line": 13, @@ -443,7 +443,7 @@ }, "end": { "line": 13, - "column": 23 + "column": 22 } }, "readonly": true, @@ -471,7 +471,7 @@ { "type": "ClassProperty", "start": 223, - "end": 243, + "end": 242, "loc": { "start": { "line": 15, @@ -479,7 +479,7 @@ }, "end": { "line": 15, - "column": 24 + "column": 23 } }, "accessibility": "public", @@ -508,7 +508,7 @@ { "type": "ClassProperty", "start": 248, - "end": 268, + "end": 267, "loc": { "start": { "line": 16, @@ -516,7 +516,7 @@ }, "end": { "line": 16, - "column": 24 + "column": 23 } }, "accessibility": "public", @@ -545,7 +545,7 @@ { "type": "ClassProperty", "start": 273, - "end": 291, + "end": 290, "loc": { "start": { "line": 17, @@ -553,7 +553,7 @@ }, "end": { "line": 17, - "column": 22 + "column": 21 } }, "accessibility": "public", @@ -581,7 +581,7 @@ { "type": "ClassProperty", "start": 296, - "end": 326, + "end": 325, "loc": { "start": { "line": 18, @@ -589,7 +589,7 @@ }, "end": { "line": 18, - "column": 34 + "column": 33 } }, "accessibility": "public", @@ -619,7 +619,7 @@ { "type": "ClassProperty", "start": 331, - "end": 361, + "end": 360, "loc": { "start": { "line": 19, @@ -627,7 +627,7 @@ }, "end": { "line": 19, - "column": 34 + "column": 33 } }, "accessibility": "public", @@ -657,7 +657,7 @@ { "type": "ClassProperty", "start": 366, - "end": 394, + "end": 393, "loc": { "start": { "line": 20, @@ -665,7 +665,7 @@ }, "end": { "line": 20, - "column": 32 + "column": 31 } }, "accessibility": "public", @@ -697,4 +697,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/typescript/class/properties/expected.json b/test/fixtures/typescript/class/properties/expected.json index 8cc2487abd..b0841c160e 100644 --- a/test/fixtures/typescript/class/properties/expected.json +++ b/test/fixtures/typescript/class/properties/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 14, - "end": 16, + "end": 15, "loc": { "start": { "line": 2, @@ -86,7 +86,7 @@ }, "end": { "line": 2, - "column": 6 + "column": 5 } }, "static": false, @@ -113,7 +113,7 @@ { "type": "ClassProperty", "start": 21, - "end": 24, + "end": 23, "loc": { "start": { "line": 3, @@ -121,7 +121,7 @@ }, "end": { "line": 3, - "column": 7 + "column": 6 } }, "static": false, @@ -149,7 +149,7 @@ { "type": "ClassProperty", "start": 29, - "end": 39, + "end": 38, "loc": { "start": { "line": 4, @@ -157,7 +157,7 @@ }, "end": { "line": 4, - "column": 14 + "column": 13 } }, "static": false, @@ -214,7 +214,7 @@ { "type": "ClassProperty", "start": 44, - "end": 58, + "end": 57, "loc": { "start": { "line": 5, @@ -222,7 +222,7 @@ }, "end": { "line": 5, - "column": 18 + "column": 17 } }, "static": false, @@ -301,4 +301,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/typescript/class/property-computed/expected.json b/test/fixtures/typescript/class/property-computed/expected.json index 7978804e58..b44212139c 100644 --- a/test/fixtures/typescript/class/property-computed/expected.json +++ b/test/fixtures/typescript/class/property-computed/expected.json @@ -78,7 +78,7 @@ { "type": "ClassProperty", "start": 14, - "end": 40, + "end": 39, "loc": { "start": { "line": 2, @@ -86,7 +86,7 @@ }, "end": { "line": 2, - "column": 30 + "column": 29 } }, "static": false, @@ -176,7 +176,7 @@ { "type": "ClassProperty", "start": 45, - "end": 72, + "end": 71, "loc": { "start": { "line": 3, @@ -184,7 +184,7 @@ }, "end": { "line": 3, - "column": 31 + "column": 30 } }, "static": false, @@ -278,4 +278,4 @@ ], "directives": [] } -} \ No newline at end of file +}