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

Commit 1ba5f61

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

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
@@ -1123,10 +1123,8 @@ module.exports = function convert(config) {
11231123

11241124
if (node.dotDotDotToken) {
11251125
Object.assign(result, {
1126-
type: AST_NODE_TYPES.ExperimentalRestProperty,
1127-
argument: convertChild(node.propertyName || node.name),
1128-
computed: Boolean(node.propertyName && node.propertyName.kind === SyntaxKind.ComputedPropertyName),
1129-
shorthand: !node.propertyName
1126+
type: AST_NODE_TYPES.RestElement,
1127+
argument: convertChild(node.propertyName || node.name)
11301128
});
11311129
} else {
11321130
Object.assign(result, {
@@ -1270,16 +1268,16 @@ module.exports = function convert(config) {
12701268
break;
12711269
}
12721270
case SyntaxKind.SpreadAssignment: {
1273-
let type = AST_NODE_TYPES.ExperimentalSpreadProperty;
1271+
let type = AST_NODE_TYPES.SpreadElement;
12741272

12751273
if (node.parent &&
12761274
node.parent.parent &&
12771275
node.parent.parent.kind === SyntaxKind.BinaryExpression
12781276
) {
12791277
if (node.parent.parent.right === node.parent) {
1280-
type = AST_NODE_TYPES.ExperimentalSpreadProperty;
1278+
type = AST_NODE_TYPES.SpreadElement;
12811279
} else if (node.parent.parent.left === node.parent) {
1282-
type = AST_NODE_TYPES.ExperimentalRestProperty;
1280+
type = AST_NODE_TYPES.RestElement;
12831281
}
12841282
}
12851283

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
@@ -57581,7 +57581,6 @@ Object {
5758157581
],
5758257582
"type": "Identifier",
5758357583
},
57584-
"computed": false,
5758557584
"loc": Object {
5758657585
"end": Object {
5758757586
"column": 19,
@@ -57596,8 +57595,7 @@ Object {
5759657595
15,
5759757596
19,
5759857597
],
57599-
"shorthand": true,
57600-
"type": "ExperimentalRestProperty",
57598+
"type": "RestElement",
5760157599
},
5760257600
],
5760357601
"range": Array [
@@ -57958,7 +57956,7 @@ Object {
5795857956
5,
5795957957
9,
5796057958
],
57961-
"type": "ExperimentalRestProperty",
57959+
"type": "RestElement",
5796257960
},
5796357961
],
5796457962
"range": Array [
@@ -58084,7 +58082,7 @@ Object {
5808458082
17,
5808558083
21,
5808658084
],
58087-
"type": "ExperimentalSpreadProperty",
58085+
"type": "SpreadElement",
5808858086
},
5808958087
],
5809058088
"range": Array [
@@ -58488,7 +58486,6 @@ Object {
5848858486
],
5848958487
"type": "Identifier",
5849058488
},
58491-
"computed": false,
5849258489
"loc": Object {
5849358490
"end": Object {
5849458491
"column": 20,
@@ -58503,8 +58500,7 @@ Object {
5850358500
14,
5850458501
20,
5850558502
],
58506-
"shorthand": true,
58507-
"type": "ExperimentalRestProperty",
58503+
"type": "RestElement",
5850858504
},
5850958505
],
5851058506
"range": Array [
@@ -58873,7 +58869,6 @@ Object {
5887358869
],
5887458870
"type": "Identifier",
5887558871
},
58876-
"computed": false,
5887758872
"loc": Object {
5887858873
"end": Object {
5887958874
"column": 16,
@@ -58888,8 +58883,7 @@ Object {
5888858883
12,
5888958884
16,
5889058885
],
58891-
"shorthand": true,
58892-
"type": "ExperimentalRestProperty",
58886+
"type": "RestElement",
5889358887
},
5889458888
],
5889558889
"range": Array [
@@ -60056,7 +60050,7 @@ Object {
6005660050
70,
6005760051
80,
6005860052
],
60059-
"type": "ExperimentalSpreadProperty",
60053+
"type": "SpreadElement",
6006060054
},
6006160055
],
6006260056
"range": Array [
@@ -60804,7 +60798,6 @@ Object {
6080460798
],
6080560799
"type": "Identifier",
6080660800
},
60807-
"computed": false,
6080860801
"loc": Object {
6080960802
"end": Object {
6081060803
"column": 45,
@@ -60819,8 +60812,7 @@ Object {
6081960812
38,
6082060813
48,
6082160814
],
60822-
"shorthand": true,
60823-
"type": "ExperimentalRestProperty",
60815+
"type": "RestElement",
6082460816
},
6082560817
],
6082660818
"range": Array [
@@ -61459,7 +61451,6 @@ Object {
6145961451
],
6146061452
"type": "Identifier",
6146161453
},
61462-
"computed": false,
6146361454
"loc": Object {
6146461455
"end": Object {
6146561456
"column": 45,
@@ -61474,8 +61465,7 @@ Object {
6147461465
45,
6147561466
55,
6147661467
],
61477-
"shorthand": true,
61478-
"type": "ExperimentalRestProperty",
61468+
"type": "RestElement",
6147961469
},
6148061470
],
6148161471
"range": Array [
@@ -62208,7 +62198,7 @@ Object {
6220862198
60,
6220962199
66,
6221062200
],
62211-
"type": "ExperimentalSpreadProperty",
62201+
"type": "SpreadElement",
6221262202
},
6221362203
],
6221462204
"range": Array [
@@ -62926,7 +62916,7 @@ Object {
6292662916
70,
6292762917
76,
6292862918
],
62929-
"type": "ExperimentalSpreadProperty",
62919+
"type": "SpreadElement",
6293062920
},
6293162921
],
6293262922
"range": Array [
@@ -63568,7 +63558,7 @@ Object {
6356863558
9,
6356963559
13,
6357063560
],
63571-
"type": "ExperimentalSpreadProperty",
63561+
"type": "SpreadElement",
6357263562
},
6357363563
],
6357463564
"range": Array [
@@ -64067,7 +64057,7 @@ Object {
6406764057
56,
6406864058
62,
6406964059
],
64070-
"type": "ExperimentalSpreadProperty",
64060+
"type": "SpreadElement",
6407164061
},
6407264062
Object {
6407364063
"argument": Object {
@@ -64102,7 +64092,7 @@ Object {
6410264092
68,
6410364093
74,
6410464094
],
64105-
"type": "ExperimentalSpreadProperty",
64095+
"type": "SpreadElement",
6410664096
},
6410764097
],
6410864098
"range": Array [

0 commit comments

Comments
 (0)