From 5d83e2692fa1d697ef3405462887b68df8a9266c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Fri, 25 Aug 2017 01:31:50 +0200 Subject: [PATCH] Adjusted Object Rest/Spread syntax handling to the latest spec (#670) --- scripts/test262_whitelist.txt | 2 - src/parser/expression.js | 5 +- src/parser/lval.js | 12 + .../es2015/destructuring/nested/actual.js | 1 - .../es2015/destructuring/nested/expected.json | 300 ------------------ .../es2015/destructuring/nested/options.json | 3 - .../object-rest-spread/16/expected.json | 243 -------------- .../object-rest-spread/16/options.json | 3 + .../object-rest-spread/17/expected.json | 278 ---------------- .../object-rest-spread/17/options.json | 3 + .../object-rest-spread/18/actual.js | 1 + .../object-rest-spread/18/options.json | 3 + .../object-rest-spread/19/actual.js | 1 + .../object-rest-spread/19/options.json | 3 + .../object-rest-spread/20/actual.js | 1 + .../object-rest-spread/20/options.json | 3 + .../object-rest-spread/21/actual.js | 1 + .../object-rest-spread/21/options.json | 3 + .../object-rest-spread/22/actual.js | 1 + .../object-rest-spread/22/options.json | 3 + .../object-rest-spread/23/actual.js | 1 + .../object-rest-spread/23/options.json | 3 + .../object-rest-spread/24/actual.js | 1 + .../object-rest-spread/24/options.json | 3 + .../object-rest-spread/25/actual.js | 1 + .../object-rest-spread/25/options.json | 3 + .../object-rest-spread/26/actual.js | 1 + .../object-rest-spread/26/options.json | 3 + test/helpers/runFixtureTests.js | 1 - yarn.lock | 6 +- 30 files changed, 58 insertions(+), 835 deletions(-) delete mode 100644 test/fixtures/es2015/destructuring/nested/actual.js delete mode 100644 test/fixtures/es2015/destructuring/nested/expected.json delete mode 100644 test/fixtures/es2015/destructuring/nested/options.json delete mode 100644 test/fixtures/experimental/object-rest-spread/16/expected.json create mode 100644 test/fixtures/experimental/object-rest-spread/16/options.json delete mode 100644 test/fixtures/experimental/object-rest-spread/17/expected.json create mode 100644 test/fixtures/experimental/object-rest-spread/17/options.json create mode 100644 test/fixtures/experimental/object-rest-spread/18/actual.js create mode 100644 test/fixtures/experimental/object-rest-spread/18/options.json create mode 100644 test/fixtures/experimental/object-rest-spread/19/actual.js create mode 100644 test/fixtures/experimental/object-rest-spread/19/options.json create mode 100644 test/fixtures/experimental/object-rest-spread/20/actual.js create mode 100644 test/fixtures/experimental/object-rest-spread/20/options.json create mode 100644 test/fixtures/experimental/object-rest-spread/21/actual.js create mode 100644 test/fixtures/experimental/object-rest-spread/21/options.json create mode 100644 test/fixtures/experimental/object-rest-spread/22/actual.js create mode 100644 test/fixtures/experimental/object-rest-spread/22/options.json create mode 100644 test/fixtures/experimental/object-rest-spread/23/actual.js create mode 100644 test/fixtures/experimental/object-rest-spread/23/options.json create mode 100644 test/fixtures/experimental/object-rest-spread/24/actual.js create mode 100644 test/fixtures/experimental/object-rest-spread/24/options.json create mode 100644 test/fixtures/experimental/object-rest-spread/25/actual.js create mode 100644 test/fixtures/experimental/object-rest-spread/25/options.json create mode 100644 test/fixtures/experimental/object-rest-spread/26/actual.js create mode 100644 test/fixtures/experimental/object-rest-spread/26/options.json diff --git a/scripts/test262_whitelist.txt b/scripts/test262_whitelist.txt index 02f1b2dafd..ef6f801ab9 100644 --- a/scripts/test262_whitelist.txt +++ b/scripts/test262_whitelist.txt @@ -1532,5 +1532,3 @@ language/statements/try/optional-catch-binding-throws.js(default) language/statements/try/optional-catch-binding-throws.js(strict mode) language/statements/try/optional-catch-binding.js(default) language/statements/try/optional-catch-binding.js(strict mode) - - diff --git a/src/parser/expression.js b/src/parser/expression.js index 9b971a7097..547bf121bb 100644 --- a/src/parser/expression.js +++ b/src/parser/expression.js @@ -1118,8 +1118,9 @@ export default class ExpressionParser extends LValParser { if (this.hasPlugin("objectRestSpread") && this.match(tt.ellipsis)) { prop = this.parseSpread(isPattern ? { start: 0 } : undefined); - prop.type = isPattern ? "RestElement" : "SpreadElement"; - if (isPattern) this.toAssignable(prop.argument, true, "object pattern"); + if (isPattern) { + this.toAssignable(prop, true, "object pattern"); + } node.properties.push(prop); if (isPattern) { const position = this.state.start; diff --git a/src/parser/lval.js b/src/parser/lval.js index 585b200fbb..981eaf9018 100644 --- a/src/parser/lval.js +++ b/src/parser/lval.js @@ -84,6 +84,8 @@ export default class LValParser extends NodeUtils { break; case "SpreadElement": + this.checkToRestConversion(node); + node.type = "RestElement"; const arg = node.argument; this.toAssignable(arg, isBinding, contextDescription); @@ -378,4 +380,14 @@ export default class LValParser extends NodeUtils { } } } + + checkToRestConversion(node: SpreadElement): void { + const validArgumentTypes = ["Identifier", "MemberExpression"]; + + if (validArgumentTypes.indexOf(node.argument.type) !== -1) { + return; + } + + this.raise(node.argument.start, "Invalid rest operator's argument"); + } } diff --git a/test/fixtures/es2015/destructuring/nested/actual.js b/test/fixtures/es2015/destructuring/nested/actual.js deleted file mode 100644 index aa9fada3b4..0000000000 --- a/test/fixtures/es2015/destructuring/nested/actual.js +++ /dev/null @@ -1 +0,0 @@ -({ x, ...{ y, z } } = o) diff --git a/test/fixtures/es2015/destructuring/nested/expected.json b/test/fixtures/es2015/destructuring/nested/expected.json deleted file mode 100644 index a1ab80ecf3..0000000000 --- a/test/fixtures/es2015/destructuring/nested/expected.json +++ /dev/null @@ -1,300 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "operator": "=", - "left": { - "type": "ObjectPattern", - "start": 1, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "method": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, - "name": "x" - }, - "shorthand": true, - "value": { - "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, - "name": "x" - }, - "extra": { - "shorthand": true - } - }, - { - "type": "RestElement", - "start": 6, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "argument": { - "type": "ObjectPattern", - "start": 9, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "method": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "y" - }, - "name": "y" - }, - "shorthand": true, - "value": { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "y" - }, - "name": "y" - }, - "extra": { - "shorthand": true - } - }, - { - "type": "ObjectProperty", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "method": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "z" - }, - "name": "z" - }, - "shorthand": true, - "value": { - "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "z" - }, - "name": "z" - }, - "extra": { - "shorthand": true - } - } - ] - } - } - ] - }, - "right": { - "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - }, - "identifierName": "o" - }, - "name": "o" - }, - "extra": { - "parenthesized": true, - "parenStart": 0 - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/destructuring/nested/options.json b/test/fixtures/es2015/destructuring/nested/options.json deleted file mode 100644 index 527f225b5b..0000000000 --- a/test/fixtures/es2015/destructuring/nested/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["objectRestSpread"] -} diff --git a/test/fixtures/experimental/object-rest-spread/16/expected.json b/test/fixtures/experimental/object-rest-spread/16/expected.json deleted file mode 100644 index 317f0a9f5d..0000000000 --- a/test/fixtures/experimental/object-rest-spread/16/expected.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "sourceType": "script", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "id": { - "type": "ObjectPattern", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "properties": [ - { - "type": "RestElement", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "argument": { - "type": "ObjectPattern", - "start": 8, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "method": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "z" - }, - "name": "z" - }, - "shorthand": true, - "value": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "z" - }, - "name": "z" - }, - "extra": { - "shorthand": true - } - } - ] - } - } - ] - }, - "init": { - "type": "ObjectExpression", - "start": 15, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "method": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "z" - }, - "name": "z" - }, - "shorthand": false, - "value": { - "type": "NumericLiteral", - "start": 20, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "extra": { - "rawValue": 1, - "raw": "1" - }, - "value": 1 - } - } - ] - } - } - ], - "kind": "var" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/experimental/object-rest-spread/16/options.json b/test/fixtures/experimental/object-rest-spread/16/options.json new file mode 100644 index 0000000000..f65c23001f --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/16/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Invalid rest operator's argument (1:8)" +} diff --git a/test/fixtures/experimental/object-rest-spread/17/expected.json b/test/fixtures/experimental/object-rest-spread/17/expected.json deleted file mode 100644 index a37ac1e771..0000000000 --- a/test/fixtures/experimental/object-rest-spread/17/expected.json +++ /dev/null @@ -1,278 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "sourceType": "script", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "id": { - "type": "ObjectPattern", - "start": 4, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "properties": [ - { - "type": "RestElement", - "start": 6, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "argument": { - "type": "ObjectPattern", - "start": 9, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "method": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, - "name": "x" - }, - "shorthand": true, - "value": { - "type": "AssignmentPattern", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "left": { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, - "name": "x" - }, - "right": { - "type": "NumericLiteral", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "extra": { - "rawValue": 5, - "raw": "5" - }, - "value": 5 - } - }, - "extra": { - "shorthand": true - } - } - ] - } - } - ] - }, - "init": { - "type": "ObjectExpression", - "start": 23, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "method": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "x" - }, - "name": "x" - }, - "shorthand": false, - "value": { - "type": "NumericLiteral", - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "extra": { - "rawValue": 1, - "raw": "1" - }, - "value": 1 - } - } - ] - } - } - ], - "kind": "var" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/experimental/object-rest-spread/17/options.json b/test/fixtures/experimental/object-rest-spread/17/options.json new file mode 100644 index 0000000000..bf0116a7b0 --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/17/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Invalid rest operator's argument (1:9)" +} diff --git a/test/fixtures/experimental/object-rest-spread/18/actual.js b/test/fixtures/experimental/object-rest-spread/18/actual.js new file mode 100644 index 0000000000..78c283fdd7 --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/18/actual.js @@ -0,0 +1 @@ +({...{}} = {}) diff --git a/test/fixtures/experimental/object-rest-spread/18/options.json b/test/fixtures/experimental/object-rest-spread/18/options.json new file mode 100644 index 0000000000..b447c590ab --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/18/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Invalid rest operator's argument (1:5)" +} diff --git a/test/fixtures/experimental/object-rest-spread/19/actual.js b/test/fixtures/experimental/object-rest-spread/19/actual.js new file mode 100644 index 0000000000..6bea6f42a5 --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/19/actual.js @@ -0,0 +1 @@ +function test({...{}}) {} diff --git a/test/fixtures/experimental/object-rest-spread/19/options.json b/test/fixtures/experimental/object-rest-spread/19/options.json new file mode 100644 index 0000000000..6a9895dd9d --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/19/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Invalid rest operator's argument (1:18)" +} diff --git a/test/fixtures/experimental/object-rest-spread/20/actual.js b/test/fixtures/experimental/object-rest-spread/20/actual.js new file mode 100644 index 0000000000..cbba727034 --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/20/actual.js @@ -0,0 +1 @@ +function test({...{a}}) {} diff --git a/test/fixtures/experimental/object-rest-spread/20/options.json b/test/fixtures/experimental/object-rest-spread/20/options.json new file mode 100644 index 0000000000..6a9895dd9d --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/20/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Invalid rest operator's argument (1:18)" +} diff --git a/test/fixtures/experimental/object-rest-spread/21/actual.js b/test/fixtures/experimental/object-rest-spread/21/actual.js new file mode 100644 index 0000000000..c77a2b42c6 --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/21/actual.js @@ -0,0 +1 @@ +({...x = 1} = {}) diff --git a/test/fixtures/experimental/object-rest-spread/21/options.json b/test/fixtures/experimental/object-rest-spread/21/options.json new file mode 100644 index 0000000000..b447c590ab --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/21/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Invalid rest operator's argument (1:5)" +} diff --git a/test/fixtures/experimental/object-rest-spread/22/actual.js b/test/fixtures/experimental/object-rest-spread/22/actual.js new file mode 100644 index 0000000000..511db8499f --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/22/actual.js @@ -0,0 +1 @@ +var {...x = 1} = {} diff --git a/test/fixtures/experimental/object-rest-spread/22/options.json b/test/fixtures/experimental/object-rest-spread/22/options.json new file mode 100644 index 0000000000..f65c23001f --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/22/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Invalid rest operator's argument (1:8)" +} diff --git a/test/fixtures/experimental/object-rest-spread/23/actual.js b/test/fixtures/experimental/object-rest-spread/23/actual.js new file mode 100644 index 0000000000..97b3f693e0 --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/23/actual.js @@ -0,0 +1 @@ +function test({...x = 1}) {} diff --git a/test/fixtures/experimental/object-rest-spread/23/options.json b/test/fixtures/experimental/object-rest-spread/23/options.json new file mode 100644 index 0000000000..6a9895dd9d --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/23/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Invalid rest operator's argument (1:18)" +} diff --git a/test/fixtures/experimental/object-rest-spread/24/actual.js b/test/fixtures/experimental/object-rest-spread/24/actual.js new file mode 100644 index 0000000000..4d2f660555 --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/24/actual.js @@ -0,0 +1 @@ +({...[]} = {}) diff --git a/test/fixtures/experimental/object-rest-spread/24/options.json b/test/fixtures/experimental/object-rest-spread/24/options.json new file mode 100644 index 0000000000..b447c590ab --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/24/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Invalid rest operator's argument (1:5)" +} diff --git a/test/fixtures/experimental/object-rest-spread/25/actual.js b/test/fixtures/experimental/object-rest-spread/25/actual.js new file mode 100644 index 0000000000..96954ff035 --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/25/actual.js @@ -0,0 +1 @@ +var {...[]} = {} diff --git a/test/fixtures/experimental/object-rest-spread/25/options.json b/test/fixtures/experimental/object-rest-spread/25/options.json new file mode 100644 index 0000000000..f65c23001f --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/25/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Invalid rest operator's argument (1:8)" +} diff --git a/test/fixtures/experimental/object-rest-spread/26/actual.js b/test/fixtures/experimental/object-rest-spread/26/actual.js new file mode 100644 index 0000000000..23d38c2ded --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/26/actual.js @@ -0,0 +1 @@ +function test({...[]}) {} diff --git a/test/fixtures/experimental/object-rest-spread/26/options.json b/test/fixtures/experimental/object-rest-spread/26/options.json new file mode 100644 index 0000000000..6a9895dd9d --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/26/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Invalid rest operator's argument (1:18)" +} diff --git a/test/helpers/runFixtureTests.js b/test/helpers/runFixtureTests.js index f808383c5e..0e0864d972 100644 --- a/test/helpers/runFixtureTests.js +++ b/test/helpers/runFixtureTests.js @@ -74,7 +74,6 @@ function runTest(test, parseFunction) { } let ast; - try { ast = parseFunction(test.actual.code, opts); } catch (err) { diff --git a/yarn.lock b/yarn.lock index 9fa000431b..2e2197f1cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3054,7 +3054,7 @@ minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: +minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" @@ -3062,10 +3062,6 @@ minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" - "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"