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

Commit 6eec85b

Browse files
duailibeJamesHenry
authored andcommitted
Breaking: Remove "Experimental" from rest and spread (fixes #428) (#429)
1 parent 42f29a1 commit 6eec85b

File tree

4 files changed

+21
-38
lines changed

4 files changed

+21
-38
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: 14 additions & 26 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 [
@@ -63350,7 +63344,6 @@ Object {
6335063344
],
6335163345
"type": "Identifier",
6335263346
},
63353-
"computed": false,
6335463347
"loc": Object {
6335563348
"end": Object {
6335663349
"column": 16,
@@ -63365,8 +63358,7 @@ Object {
6336563358
12,
6336663359
16,
6336763360
],
63368-
"shorthand": true,
63369-
"type": "ExperimentalRestProperty",
63361+
"type": "RestElement",
6337063362
},
6337163363
],
6337263364
"range": Array [
@@ -64533,7 +64525,7 @@ Object {
6453364525
70,
6453464526
80,
6453564527
],
64536-
"type": "ExperimentalSpreadProperty",
64528+
"type": "SpreadElement",
6453764529
},
6453864530
],
6453964531
"range": Array [
@@ -65281,7 +65273,6 @@ Object {
6528165273
],
6528265274
"type": "Identifier",
6528365275
},
65284-
"computed": false,
6528565276
"loc": Object {
6528665277
"end": Object {
6528765278
"column": 45,
@@ -65296,8 +65287,7 @@ Object {
6529665287
38,
6529765288
48,
6529865289
],
65299-
"shorthand": true,
65300-
"type": "ExperimentalRestProperty",
65290+
"type": "RestElement",
6530165291
},
6530265292
],
6530365293
"range": Array [
@@ -65936,7 +65926,6 @@ Object {
6593665926
],
6593765927
"type": "Identifier",
6593865928
},
65939-
"computed": false,
6594065929
"loc": Object {
6594165930
"end": Object {
6594265931
"column": 45,
@@ -65951,8 +65940,7 @@ Object {
6595165940
45,
6595265941
55,
6595365942
],
65954-
"shorthand": true,
65955-
"type": "ExperimentalRestProperty",
65943+
"type": "RestElement",
6595665944
},
6595765945
],
6595865946
"range": Array [
@@ -66685,7 +66673,7 @@ Object {
6668566673
60,
6668666674
66,
6668766675
],
66688-
"type": "ExperimentalSpreadProperty",
66676+
"type": "SpreadElement",
6668966677
},
6669066678
],
6669166679
"range": Array [
@@ -67403,7 +67391,7 @@ Object {
6740367391
70,
6740467392
76,
6740567393
],
67406-
"type": "ExperimentalSpreadProperty",
67394+
"type": "SpreadElement",
6740767395
},
6740867396
],
6740967397
"range": Array [
@@ -68045,7 +68033,7 @@ Object {
6804568033
9,
6804668034
13,
6804768035
],
68048-
"type": "ExperimentalSpreadProperty",
68036+
"type": "SpreadElement",
6804968037
},
6805068038
],
6805168039
"range": Array [
@@ -68544,7 +68532,7 @@ Object {
6854468532
56,
6854568533
62,
6854668534
],
68547-
"type": "ExperimentalSpreadProperty",
68535+
"type": "SpreadElement",
6854868536
},
6854968537
Object {
6855068538
"argument": Object {
@@ -68579,7 +68567,7 @@ Object {
6857968567
68,
6858068568
74,
6858168569
],
68582-
"type": "ExperimentalSpreadProperty",
68570+
"type": "SpreadElement",
6858368571
},
6858468572
],
6858568573
"range": Array [

0 commit comments

Comments
 (0)