Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit e828817

Browse files
committed
Fix: Remove "Experimental" from rest and spread (fixes #428)
1 parent 42f29a1 commit e828817

File tree

4 files changed

+20
-35
lines changed

4 files changed

+20
-35
lines changed

lib/ast-node-types.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ module.exports = {
4242
Decorator: "Decorator",
4343
DoWhileStatement: "DoWhileStatement",
4444
EmptyStatement: "EmptyStatement",
45-
ExperimentalRestProperty: "ExperimentalRestProperty",
46-
ExperimentalSpreadProperty: "ExperimentalSpreadProperty",
4745
ExportAllDeclaration: "ExportAllDeclaration",
4846
ExportDefaultDeclaration: "ExportDefaultDeclaration",
4947
ExportNamedDeclaration: "ExportNamedDeclaration",

lib/convert.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,8 @@ module.exports = function convert(config) {
11331133

11341134
if (node.dotDotDotToken) {
11351135
Object.assign(result, {
1136-
type: AST_NODE_TYPES.ExperimentalRestProperty,
1137-
argument: convertChild(node.propertyName || node.name),
1138-
computed: Boolean(node.propertyName && node.propertyName.kind === SyntaxKind.ComputedPropertyName),
1139-
shorthand: !node.propertyName
1136+
type: AST_NODE_TYPES.RestElement,
1137+
argument: convertChild(node.propertyName || node.name)
11401138
});
11411139
} else {
11421140
Object.assign(result, {
@@ -1283,16 +1281,16 @@ module.exports = function convert(config) {
12831281
break;
12841282
}
12851283
case SyntaxKind.SpreadAssignment: {
1286-
let type = AST_NODE_TYPES.ExperimentalSpreadProperty;
1284+
let type = AST_NODE_TYPES.SpreadElement;
12871285

12881286
if (node.parent &&
12891287
node.parent.parent &&
12901288
node.parent.parent.kind === SyntaxKind.BinaryExpression
12911289
) {
12921290
if (node.parent.parent.right === node.parent) {
1293-
type = AST_NODE_TYPES.ExperimentalSpreadProperty;
1291+
type = AST_NODE_TYPES.SpreadElement;
12941292
} else if (node.parent.parent.left === node.parent) {
1295-
type = AST_NODE_TYPES.ExperimentalRestProperty;
1293+
type = AST_NODE_TYPES.RestElement;
12961294
}
12971295
}
12981296

tests/ast-alignment/fixtures-to-test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,9 @@ let fixturePatternConfigsToTest = [
105105
createFixturePatternConfigFor("ecma-features/experimentalObjectRestSpread", {
106106
ignore: [
107107
/**
108-
* "ExperimentalSpreadProperty" in espree/typescript-eslint-parser vs "SpreadElement" in Babylon
109-
* comes up a lot in this section
108+
* Trailing comma is not permitted after a "RestElement" in Babylon
110109
*/
111-
"**/*"
110+
"invalid-rest-trailing-comma"
112111
]
113112
}),
114113

tests/lib/__snapshots__/ecma-features.js.snap

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61572,7 +61572,6 @@ Object {
6157261572
],
6157361573
"type": "Identifier",
6157461574
},
61575-
"computed": false,
6157661575
"loc": Object {
6157761576
"end": Object {
6157861577
"column": 19,
@@ -61587,8 +61586,7 @@ Object {
6158761586
15,
6158861587
19,
6158961588
],
61590-
"shorthand": true,
61591-
"type": "ExperimentalRestProperty",
61589+
"type": "RestElement",
6159261590
},
6159361591
],
6159461592
"range": Array [
@@ -61949,7 +61947,7 @@ Object {
6194961947
5,
6195061948
9,
6195161949
],
61952-
"type": "ExperimentalRestProperty",
61950+
"type": "RestElement",
6195361951
},
6195461952
],
6195561953
"range": Array [
@@ -62075,7 +62073,7 @@ Object {
6207562073
17,
6207662074
21,
6207762075
],
62078-
"type": "ExperimentalSpreadProperty",
62076+
"type": "SpreadElement",
6207962077
},
6208062078
],
6208162079
"range": Array [
@@ -62479,7 +62477,6 @@ Object {
6247962477
],
6248062478
"type": "Identifier",
6248162479
},
62482-
"computed": false,
6248362480
"loc": Object {
6248462481
"end": Object {
6248562482
"column": 20,
@@ -62494,8 +62491,7 @@ Object {
6249462491
14,
6249562492
20,
6249662493
],
62497-
"shorthand": true,
62498-
"type": "ExperimentalRestProperty",
62494+
"type": "RestElement",
6249962495
},
6250062496
],
6250162497
"range": Array [
@@ -62866,7 +62862,6 @@ Object {
6286662862
],
6286762863
"type": "Identifier",
6286862864
},
62869-
"computed": false,
6287062865
"loc": Object {
6287162866
"end": Object {
6287262867
"column": 16,
@@ -62881,8 +62876,7 @@ Object {
6288162876
12,
6288262877
16,
6288362878
],
62884-
"shorthand": true,
62885-
"type": "ExperimentalRestProperty",
62879+
"type": "RestElement",
6288662880
},
6288762881
],
6288862882
"range": Array [
@@ -64533,7 +64527,7 @@ Object {
6453364527
70,
6453464528
80,
6453564529
],
64536-
"type": "ExperimentalSpreadProperty",
64530+
"type": "SpreadElement",
6453764531
},
6453864532
],
6453964533
"range": Array [
@@ -65281,7 +65275,6 @@ Object {
6528165275
],
6528265276
"type": "Identifier",
6528365277
},
65284-
"computed": false,
6528565278
"loc": Object {
6528665279
"end": Object {
6528765280
"column": 45,
@@ -65296,8 +65289,7 @@ Object {
6529665289
38,
6529765290
48,
6529865291
],
65299-
"shorthand": true,
65300-
"type": "ExperimentalRestProperty",
65292+
"type": "RestElement",
6530165293
},
6530265294
],
6530365295
"range": Array [
@@ -65936,7 +65928,6 @@ Object {
6593665928
],
6593765929
"type": "Identifier",
6593865930
},
65939-
"computed": false,
6594065931
"loc": Object {
6594165932
"end": Object {
6594265933
"column": 45,
@@ -65951,8 +65942,7 @@ Object {
6595165942
45,
6595265943
55,
6595365944
],
65954-
"shorthand": true,
65955-
"type": "ExperimentalRestProperty",
65945+
"type": "RestElement",
6595665946
},
6595765947
],
6595865948
"range": Array [
@@ -66685,7 +66675,7 @@ Object {
6668566675
60,
6668666676
66,
6668766677
],
66688-
"type": "ExperimentalSpreadProperty",
66678+
"type": "SpreadElement",
6668966679
},
6669066680
],
6669166681
"range": Array [
@@ -67403,7 +67393,7 @@ Object {
6740367393
70,
6740467394
76,
6740567395
],
67406-
"type": "ExperimentalSpreadProperty",
67396+
"type": "SpreadElement",
6740767397
},
6740867398
],
6740967399
"range": Array [
@@ -68045,7 +68035,7 @@ Object {
6804568035
9,
6804668036
13,
6804768037
],
68048-
"type": "ExperimentalSpreadProperty",
68038+
"type": "SpreadElement",
6804968039
},
6805068040
],
6805168041
"range": Array [
@@ -68544,7 +68534,7 @@ Object {
6854468534
56,
6854568535
62,
6854668536
],
68547-
"type": "ExperimentalSpreadProperty",
68537+
"type": "SpreadElement",
6854868538
},
6854968539
Object {
6855068540
"argument": Object {
@@ -68579,7 +68569,7 @@ Object {
6857968569
68,
6858068570
74,
6858168571
],
68582-
"type": "ExperimentalSpreadProperty",
68572+
"type": "SpreadElement",
6858368573
},
6858468574
],
6858568575
"range": Array [

0 commit comments

Comments
 (0)