[Pkg-javascript-commits] [node-acorn-jsx] 417/484: Switch from Function.{rest, defaults} to AssignmentPattern and RestElement.
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:21:04 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-acorn-jsx.
commit 917de714b145882aa65d21c121eeeae0e76b4c99
Author: Ingvar Stepanyan <me at rreverser.com>
Date: Fri Jan 23 15:29:37 2015 +0200
Switch from Function.{rest,defaults} to AssignmentPattern and RestElement.
Closes #182.
---
acorn.js | 113 +--
acorn_loose.js | 49 +-
test/tests-harmony.js | 2381 +++++++++++++++++++++++--------------------------
test/tests.js | 87 +-
4 files changed, 1225 insertions(+), 1405 deletions(-)
diff --git a/acorn.js b/acorn.js
index 491a3e2..6cf6a60 100644
--- a/acorn.js
+++ b/acorn.js
@@ -1472,9 +1472,7 @@
case "ArrayExpression":
node.type = "ArrayPattern";
- for (var i = 0, lastI = node.elements.length - 1; i <= lastI; i++) {
- toAssignable(node.elements[i], i === lastI, checkType);
- }
+ toAssignableList(node.elements, checkType);
break;
case "SpreadElement":
@@ -1502,6 +1500,15 @@
return node;
}
+ // Convert list of expression atoms to binding list.
+
+ function toAssignableList(exprList, checkType) {
+ for (var i = 0; i < exprList.length; i++) {
+ toAssignable(exprList[i], i === exprList.length - 1, checkType);
+ }
+ return exprList;
+ }
+
// Parses spread element.
function parseSpread() {
@@ -1530,16 +1537,7 @@
case _bracketL:
var node = startNode();
next();
- var elts = node.elements = [], first = true;
- while (!eat(_bracketR)) {
- first ? first = false : expect(_comma);
- if (tokType === _ellipsis) {
- elts.push(parseRest());
- expect(_bracketR);
- break;
- }
- elts.push(tokType === _comma ? null : parseMaybeDefault());
- }
+ node.elements = parseAssignableList(_bracketR, true);
return finishNode(node, "ArrayPattern");
case _braceL:
@@ -1550,6 +1548,20 @@
}
}
+ function parseAssignableList(close, allowEmpty) {
+ var elts = [], first = true;
+ while (!eat(close)) {
+ first ? first = false : expect(_comma);
+ if (tokType === _ellipsis) {
+ elts.push(parseRest());
+ expect(close);
+ break;
+ }
+ elts.push(allowEmpty && tokType === _comma ? null : parseMaybeDefault());
+ }
+ return elts;
+ }
+
// Parses assignment pattern around given atom if possible.
function parseMaybeDefault(startPos, left) {
@@ -1593,6 +1605,9 @@
if (elem) checkFunctionParam(elem, nameHash);
}
break;
+
+ case "RestElement":
+ return checkFunctionParam(param.argument, nameHash);
}
}
@@ -2425,11 +2440,9 @@
function initFunction(node) {
node.id = null;
- node.params = [];
if (options.ecmaVersion >= 6) {
- node.defaults = [];
- node.rest = null;
node.generator = false;
+ node.expression = false;
}
}
@@ -2444,7 +2457,8 @@
if (isStatement || tokType === _name) {
node.id = parseIdent();
}
- parseFunctionParams(node);
+ expect(_parenL);
+ node.params = parseAssignableList(_parenR, false);
parseFunctionBody(node, allowExpressionBody);
return finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
}
@@ -2454,7 +2468,8 @@
function parseMethod(isGenerator) {
var node = startNode();
initFunction(node);
- parseFunctionParams(node);
+ expect(_parenL);
+ node.params = parseAssignableList(_parenR, false);
var allowExpressionBody;
if (options.ecmaVersion >= 6) {
node.generator = isGenerator;
@@ -2470,69 +2485,11 @@
function parseArrowExpression(node, params) {
initFunction(node);
-
- var defaults = node.defaults, hasDefaults = false;
-
- for (var i = 0, lastI = params.length - 1; i <= lastI; i++) {
- var param = params[i];
-
- if (param.type === "AssignmentExpression" && param.operator === "=") {
- hasDefaults = true;
- params[i] = param.left;
- defaults.push(param.right);
- } else {
- toAssignable(param, i === lastI, true);
- defaults.push(null);
- if (param.type === "RestElement") {
- params.length--;
- node.rest = param.argument;
- break;
- }
- }
- }
-
- node.params = params;
- if (!hasDefaults) node.defaults = [];
-
+ node.params = toAssignableList(params, true);
parseFunctionBody(node, true);
return finishNode(node, "ArrowFunctionExpression");
}
- // Parse function parameters.
-
- function parseFunctionParams(node) {
- var defaults = [], hasDefaults = false;
-
- expect(_parenL);
- for (;;) {
- if (eat(_parenR)) {
- break;
- } else if (eat(_ellipsis)) {
- node.rest = parseAssignableAtom();
- checkSpreadAssign(node.rest);
- expect(_parenR);
- defaults.push(null);
- break;
- } else {
- node.params.push(parseAssignableAtom());
- if (options.ecmaVersion >= 6) {
- if (eat(_eq)) {
- hasDefaults = true;
- defaults.push(parseExpression(true));
- } else {
- defaults.push(null);
- }
- }
- if (!eat(_comma)) {
- expect(_parenR);
- break;
- }
- }
- }
-
- if (hasDefaults) node.defaults = defaults;
- }
-
// Parse function body and check parameters.
function parseFunctionBody(node, allowExpression) {
@@ -2560,8 +2517,6 @@
checkFunctionParam(node.id, {});
for (var i = 0; i < node.params.length; i++)
checkFunctionParam(node.params[i], nameHash);
- if (node.rest)
- checkFunctionParam(node.rest, nameHash);
}
}
diff --git a/acorn_loose.js b/acorn_loose.js
index dca43af..e1ee14f 100644
--- a/acorn_loose.js
+++ b/acorn_loose.js
@@ -952,8 +952,6 @@
node.id = null;
node.params = [];
if (options.ecmaVersion >= 6) {
- node.defaults = [];
- node.rest = null;
node.generator = false;
node.expression = false;
}
@@ -969,16 +967,13 @@
node.type = "ObjectPattern";
var props = node.properties;
for (var i = 0; i < props.length; i++) {
- props[i].value = toAssignable(props[i].value);
+ toAssignable(props[i].value);
}
break;
case "ArrayExpression":
node.type = "ArrayPattern";
- var elms = node.elements;
- for (var i = 0; i < elms.length; i++) {
- elms[i] = toAssignable(elms[i]);
- }
+ toAssignableList(node.elements);
break;
case "SpreadElement":
@@ -994,33 +989,17 @@
return checkLVal(node);
}
- function parseFunctionParams(node, params) {
- var defaults = [], hasDefaults = false;
-
- if (!params) {
- pushCx();
- params = parseExprList(tt.parenR);
- }
- for (var i = 0; i < params.length; i++) {
- var param = params[i], defValue = null;
- if (param.type === "AssignmentExpression") {
- defValue = param.right;
- param = param.left;
- }
- param = toAssignable(param);
- if (param.type === "RestElement") {
- param = param.argument;
- if (i === params.length - 1) {
- node.rest = param;
- continue;
- }
- }
- node.params.push(param);
- defaults.push(defValue);
- if (defValue) hasDefaults = true;
+ function toAssignableList(exprList) {
+ for (var i = 0; i < exprList.length; i++) {
+ toAssignable(exprList[i]);
}
+ return exprList;
+ }
- if (hasDefaults) node.defaults = defaults;
+ function parseFunctionParams(params) {
+ pushCx();
+ params = parseExprList(tt.parenR);
+ return toAssignableList(params);
}
function parseFunction(node, isStatement) {
@@ -1030,7 +1009,7 @@
}
if (token.type === tt.name) node.id = parseIdent();
else if (isStatement) node.id = dummyIdent();
- parseFunctionParams(node);
+ node.params = parseFunctionParams();
node.body = parseBlock();
return finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
}
@@ -1038,7 +1017,7 @@
function parseMethod(isGenerator) {
var node = startNode();
initFunction(node);
- parseFunctionParams(node);
+ node.params = parseFunctionParams();
node.generator = isGenerator || false;
node.expression = options.ecmaVersion >= 6 && token.type !== tt.braceL;
node.body = node.expression ? parseExpression(true) : parseBlock();
@@ -1047,7 +1026,7 @@
function parseArrowExpression(node, params) {
initFunction(node);
- parseFunctionParams(node, params);
+ node.params = toAssignableList(params);
node.expression = token.type !== tt.braceL;
node.body = node.expression ? parseExpression(true) : parseBlock();
return finishNode(node, "ArrowFunctionExpression");
diff --git a/test/tests-harmony.js b/test/tests-harmony.js
index 82eafb1..9fc9dec 100644
--- a/test/tests-harmony.js
+++ b/test/tests-harmony.js
@@ -174,7 +174,6 @@ test("function test() {'use strict'; 0o0; }", {
}
},
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [
@@ -216,7 +215,6 @@ test("function test() {'use strict'; 0o0; }", {
end: {line: 1, column: 37}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -331,7 +329,6 @@ test("function test() {'use strict'; 0O0; }", {
}
},
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [
@@ -373,7 +370,6 @@ test("function test() {'use strict'; 0O0; }", {
end: {line: 1, column: 37}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -1028,8 +1024,6 @@ test("`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`",{
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
- rest: null,
generator: false,
body: {
type: "BlockStatement",
@@ -1198,7 +1192,6 @@ test("() => \"test\"", {
type: "ArrowFunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "Literal",
value: "test",
@@ -1208,7 +1201,6 @@ test("() => \"test\"", {
end: {line: 1, column: 12}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -1246,7 +1238,6 @@ test("e => \"test\"", {
end: {line: 1, column: 1}
}
}],
- defaults: [],
body: {
type: "Literal",
value: "test",
@@ -1256,7 +1247,6 @@ test("e => \"test\"", {
end: {line: 1, column: 11}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -1294,7 +1284,6 @@ test("(e) => \"test\"", {
end: {line: 1, column: 2}
}
}],
- defaults: [],
body: {
type: "Literal",
value: "test",
@@ -1304,7 +1293,6 @@ test("(e) => \"test\"", {
end: {line: 1, column: 13}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -1352,7 +1340,6 @@ test("(a, b) => \"test\"", {
}
}
],
- defaults: [],
body: {
type: "Literal",
value: "test",
@@ -1362,7 +1349,6 @@ test("(a, b) => \"test\"", {
end: {line: 1, column: 16}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -1400,7 +1386,6 @@ test("e => { 42; }", {
end: {line: 1, column: 1}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -1424,7 +1409,6 @@ test("e => { 42; }", {
end: {line: 1, column: 12}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -1462,7 +1446,6 @@ test("e => ({ property: 42 })", {
end: {line: 1, column: 1}
}
}],
- defaults: [],
body: {
type: "ObjectExpression",
properties: [{
@@ -1498,7 +1481,6 @@ test("e => ({ property: 42 })", {
end: {line: 1, column: 22}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -1536,7 +1518,6 @@ test("e => { label: 42 }", {
end: {line: 1, column: 1}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -1575,7 +1556,6 @@ test("e => { label: 42 }", {
end: {line: 1, column: 18}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -1623,7 +1603,6 @@ test("(a, b) => { 42; }", {
}
}
],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -1647,7 +1626,6 @@ test("(a, b) => { 42; }", {
end: {line: 1, column: 17}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -1703,7 +1681,6 @@ test("([a, , b]) => 42", {
end: {line: 1, column: 9}
}
}],
- defaults: [],
body: {
type: "Literal",
value: 42,
@@ -1713,7 +1690,6 @@ test("([a, , b]) => 42", {
end: {line: 1, column: 16}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -1774,7 +1750,6 @@ test("([a.a]) => 42", {
end: {line: 1, column: 6}
}
}],
- defaults: [],
body: {
type: "Literal",
value: 42,
@@ -1784,7 +1759,6 @@ test("([a.a]) => 42", {
end: {line: 1, column: 13}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -1815,20 +1789,23 @@ test("(x=1) => x * x", {
type: "ArrowFunctionExpression",
id: null,
params: [{
- type: "Identifier",
- name: "x",
- loc: {
- start: {line: 1, column: 1},
- end: {line: 1, column: 2}
- }
- }],
- defaults: [{
- type: "Literal",
- value: 1,
- raw: "1",
- loc: {
- start: {line: 1, column: 3},
- end: {line: 1, column: 4}
+ type: "AssignmentPattern",
+ left: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 1},
+ end: {line: 1, column: 2}
+ }
+ },
+ right: {
+ type: "Literal",
+ value: 1,
+ raw: "1",
+ loc: {
+ start: {line: 1, column: 3},
+ end: {line: 1, column: 4}
+ }
}
}],
body: {
@@ -1855,7 +1832,6 @@ test("(x=1) => x * x", {
end: {line: 1, column: 14}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -1893,7 +1869,6 @@ test("eval => 42", {
end: {line: 1, column: 4}
}
}],
- defaults: [],
body: {
type: "Literal",
value: 42,
@@ -1903,7 +1878,6 @@ test("eval => 42", {
end: {line: 1, column: 10}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -1941,7 +1915,6 @@ test("arguments => 42", {
end: {line: 1, column: 9}
}
}],
- defaults: [],
body: {
type: "Literal",
value: 42,
@@ -1951,7 +1924,6 @@ test("arguments => 42", {
end: {line: 1, column: 15}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -1989,7 +1961,6 @@ test("(a) => 00", {
end: {line: 1, column: 2}
}
}],
- defaults: [],
body: {
type: "Literal",
value: 0,
@@ -1999,7 +1970,6 @@ test("(a) => 00", {
end: {line: 1, column: 9}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -2047,7 +2017,6 @@ test("(eval, a) => 42", {
}
}
],
- defaults: [],
body: {
type: "Literal",
value: 42,
@@ -2057,7 +2026,6 @@ test("(eval, a) => 42", {
end: {line: 1, column: 15}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -2088,20 +2056,23 @@ test("(eval = 10) => 42", {
type: "ArrowFunctionExpression",
id: null,
params: [{
- type: "Identifier",
- name: "eval",
- loc: {
- start: {line: 1, column: 1},
- end: {line: 1, column: 5}
- }
- }],
- defaults: [{
- type: "Literal",
- value: 10,
- raw: "10",
- loc: {
- start: {line: 1, column: 8},
- end: {line: 1, column: 10}
+ type: "AssignmentPattern",
+ left: {
+ type: "Identifier",
+ name: "eval",
+ loc: {
+ start: {line: 1, column: 1},
+ end: {line: 1, column: 5}
+ }
+ },
+ right: {
+ type: "Literal",
+ value: 10,
+ raw: "10",
+ loc: {
+ start: {line: 1, column: 8},
+ end: {line: 1, column: 10}
+ }
}
}],
body: {
@@ -2113,7 +2084,6 @@ test("(eval = 10) => 42", {
end: {line: 1, column: 17}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -2153,23 +2123,23 @@ test("(eval, a = 10) => 42", {
}
},
{
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 7},
- end: {line: 1, column: 8}
- }
- }
- ],
- defaults: [
- null,
- {
- type: "Literal",
- value: 10,
- raw: "10",
- loc: {
- start: {line: 1, column: 11},
- end: {line: 1, column: 13}
+ type: "AssignmentPattern",
+ left: {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 7},
+ end: {line: 1, column: 8}
+ }
+ },
+ right: {
+ type: "Literal",
+ value: 10,
+ raw: "10",
+ loc: {
+ start: {line: 1, column: 11},
+ end: {line: 1, column: 13}
+ }
}
}
],
@@ -2182,7 +2152,6 @@ test("(eval, a = 10) => 42", {
end: {line: 1, column: 20}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -2220,7 +2189,6 @@ test("(x => x)", {
end: {line: 1, column: 2}
}
}],
- defaults: [],
body: {
type: "Identifier",
name: "x",
@@ -2229,7 +2197,6 @@ test("(x => x)", {
end: {line: 1, column: 7}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -2267,7 +2234,6 @@ test("x => y => 42", {
end: {line: 1, column: 1}
}
}],
- defaults: [],
body: {
type: "ArrowFunctionExpression",
id: null,
@@ -2279,7 +2245,6 @@ test("x => y => 42", {
end: {line: 1, column: 6}
}
}],
- defaults: [],
body: {
type: "Literal",
value: 42,
@@ -2289,7 +2254,6 @@ test("x => y => 42", {
end: {line: 1, column: 12}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -2297,7 +2261,6 @@ test("x => y => 42", {
end: {line: 1, column: 12}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -2335,7 +2298,6 @@ test("(x) => ((y, z) => (x, y, z))", {
end: {line: 1, column: 2}
}
}],
- defaults: [],
body: {
type: "ArrowFunctionExpression",
id: null,
@@ -2357,7 +2319,6 @@ test("(x) => ((y, z) => (x, y, z))", {
}
}
],
- defaults: [],
body: {
type: "SequenceExpression",
expressions: [
@@ -2391,7 +2352,6 @@ test("(x) => ((y, z) => (x, y, z))", {
end: {line: 1, column: 26}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -2399,7 +2359,6 @@ test("(x) => ((y, z) => (x, y, z))", {
end: {line: 1, column: 27}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -2440,7 +2399,6 @@ test("foo(() => {})", {
type: "ArrowFunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -2449,7 +2407,6 @@ test("foo(() => {})", {
end: {line: 1, column: 12}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -2512,7 +2469,6 @@ test("foo((x, y) => {})", {
}
}
],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -2521,7 +2477,6 @@ test("foo((x, y) => {})", {
end: {line: 1, column: 16}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -2586,8 +2541,6 @@ test("(a, a) => 42", {
name: "a"
}
],
- defaults: [],
- rest: null,
generator: false,
body: {
type: "Literal",
@@ -2640,7 +2593,6 @@ test("x = { method() { } }", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -2649,7 +2601,6 @@ test("x = { method() { } }", {
end: {line: 1, column: 18}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -2729,7 +2680,6 @@ test("x = { method(test) { } }", {
end: {line: 1, column: 17}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -2738,7 +2688,6 @@ test("x = { method(test) { } }", {
end: {line: 1, column: 22}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -2812,7 +2761,6 @@ test("x = { 'method'() { } }", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -2821,7 +2769,6 @@ test("x = { 'method'() { } }", {
end: {line: 1, column: 20}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -2894,7 +2841,6 @@ test("x = { get() { } }", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -2903,7 +2849,6 @@ test("x = { get() { } }", {
end: {line: 1, column: 15}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -2976,7 +2921,6 @@ test("x = { set() { } }", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -2985,7 +2929,6 @@ test("x = { set() { } }", {
end: {line: 1, column: 15}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -3058,7 +3001,6 @@ test("x = { method() 42 }", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "Literal",
value: 42,
@@ -3068,7 +3010,6 @@ test("x = { method() 42 }", {
end: {line: 1, column: 17}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -3141,7 +3082,6 @@ test("x = { get method() 42 }", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "Literal",
value: 42,
@@ -3151,7 +3091,6 @@ test("x = { get method() 42 }", {
end: {line: 1, column: 21}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -3231,7 +3170,6 @@ test("x = { set method(val) v = val }", {
end: {line: 1, column: 20}
}
}],
- defaults: [],
body: {
type: "AssignmentExpression",
operator: "=",
@@ -3256,7 +3194,6 @@ test("x = { set method(val) v = val }", {
end: {line: 1, column: 29}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -4834,7 +4771,6 @@ test("export function parse() { }", {
}
},
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -4843,7 +4779,6 @@ test("export function parse() { }", {
end: {line: 1, column: 27}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -5615,7 +5550,6 @@ test("(function* () { yield v })", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -5646,7 +5580,6 @@ test("(function* () { yield v })", {
end: {line: 1, column: 25}
}
},
- rest: null,
generator: true,
expression: false,
loc: {
@@ -5677,7 +5610,6 @@ test("(function* () { yield\nv })", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [
@@ -5718,7 +5650,6 @@ test("(function* () { yield\nv })", {
end: {line: 2, column: 3}
}
},
- rest: null,
generator: true,
expression: false,
loc: {
@@ -5749,7 +5680,6 @@ test("(function* () { yield *v })", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -5780,7 +5710,6 @@ test("(function* () { yield *v })", {
end: {line: 1, column: 26}
}
},
- rest: null,
generator: true,
expression: false,
loc: {
@@ -5816,7 +5745,6 @@ test("function* test () { yield *v }", {
}
},
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -5847,7 +5775,6 @@ test("function* test () { yield *v }", {
end: {line: 1, column: 30}
}
},
- rest: null,
generator: true,
expression: false,
loc: {
@@ -5895,7 +5822,6 @@ test("var x = { *test () { yield *v } };", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -5926,7 +5852,6 @@ test("var x = { *test () { yield *v } };", {
end: {line: 1, column: 31}
}
},
- rest: null,
generator: true,
expression: false,
loc: {
@@ -5982,7 +5907,6 @@ test("function* t() {}", {
}
},
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -5991,7 +5915,6 @@ test("function* t() {}", {
end: {line: 1, column: 16}
}
},
- rest: null,
generator: true,
expression: false,
loc: {
@@ -6017,7 +5940,6 @@ test("(function* () { yield yield 10 })", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -6057,7 +5979,6 @@ test("(function* () { yield yield 10 })", {
end: {line: 1, column: 32}
}
},
- rest: null,
generator: true,
expression: false,
loc: {
@@ -6554,7 +6475,6 @@ test("class A {get() {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -6563,7 +6483,6 @@ test("class A {get() {}}", {
end: {line: 1, column: 17}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -6628,7 +6547,6 @@ test("class A { static get() {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -6637,7 +6555,6 @@ test("class A { static get() {}}", {
end: {line: 1, column: 25}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -6709,7 +6626,6 @@ test("class A extends B {get foo() {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -6718,7 +6634,6 @@ test("class A extends B {get foo() {}}", {
end: {line: 1, column: 31}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -6790,7 +6705,6 @@ test("class A extends B { static get foo() {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -6799,7 +6713,6 @@ test("class A extends B { static get foo() {}}", {
end: {line: 1, column: 39}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -6871,7 +6784,6 @@ test("class A {set a(v) {}}", {
end: {line: 1, column: 16}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -6880,7 +6792,6 @@ test("class A {set a(v) {}}", {
end: {line: 1, column: 20}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -6952,7 +6863,6 @@ test("class A { static set a(v) {}}", {
end: {line: 1, column: 24}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -6961,7 +6871,6 @@ test("class A { static set a(v) {}}", {
end: {line: 1, column: 28}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -7033,7 +6942,6 @@ test("class A {set(v) {};}", {
end: {line: 1, column: 14}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -7042,7 +6950,6 @@ test("class A {set(v) {};}", {
end: {line: 1, column: 18}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -7114,7 +7021,6 @@ test("class A { static set(v) {};}", {
end: {line: 1, column: 22}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -7123,7 +7029,6 @@ test("class A { static set(v) {};}", {
end: {line: 1, column: 26}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -7195,7 +7100,6 @@ test("class A {*gen(v) { yield v; }}", {
end: {line: 1, column: 15}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -7226,7 +7130,6 @@ test("class A {*gen(v) { yield v; }}", {
end: {line: 1, column: 29}
}
},
- rest: null,
generator: true,
expression: false,
loc: {
@@ -7298,7 +7201,6 @@ test("class A { static *gen(v) { yield v; }}", {
end: {line: 1, column: 23}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -7329,7 +7231,6 @@ test("class A { static *gen(v) { yield v; }}", {
end: {line: 1, column: 37}
}
},
- rest: null,
generator: true,
expression: false,
loc: {
@@ -7413,7 +7314,6 @@ test("\"use strict\"; (class A {constructor() { super() }})", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -7444,7 +7344,6 @@ test("\"use strict\"; (class A {constructor() { super() }})", {
end: {line: 1, column: 49}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -7515,7 +7414,6 @@ test("class A {static foo() {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -7524,7 +7422,6 @@ test("class A {static foo() {}}", {
end: {line: 1, column: 24}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -7590,7 +7487,6 @@ test("class A {foo() {} static bar() {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -7599,7 +7495,6 @@ test("class A {foo() {} static bar() {}}", {
end: {line: 1, column: 17}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -7629,7 +7524,6 @@ test("class A {foo() {} static bar() {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -7638,7 +7532,6 @@ test("class A {foo() {} static bar() {}}", {
end: {line: 1, column: 33}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -7723,7 +7616,6 @@ test("\"use strict\"; (class A { static constructor() { super() }})", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -7754,7 +7646,6 @@ test("\"use strict\"; (class A { static constructor() { super() }})", {
end: {line: 1, column: 57}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -7826,7 +7717,6 @@ test("class A { foo() {} bar() {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -7835,7 +7725,6 @@ test("class A { foo() {} bar() {}}", {
end: {line: 1, column: 18}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -7865,7 +7754,6 @@ test("class A { foo() {} bar() {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -7874,7 +7762,6 @@ test("class A { foo() {} bar() {}}", {
end: {line: 1, column: 27}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -7941,7 +7828,6 @@ test("class A { get foo() {} set foo(v) {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -7950,7 +7836,6 @@ test("class A { get foo() {} set foo(v) {}}", {
end: {line: 1, column: 22}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -7987,7 +7872,6 @@ test("class A { get foo() {} set foo(v) {}}", {
end: {line: 1, column: 32}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -7996,7 +7880,6 @@ test("class A { get foo() {} set foo(v) {}}", {
end: {line: 1, column: 36}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -8063,7 +7946,6 @@ test("class A { static get foo() {} get foo() {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -8072,7 +7954,6 @@ test("class A { static get foo() {} get foo() {}}", {
end: {line: 1, column: 29}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -8102,7 +7983,6 @@ test("class A { static get foo() {} get foo() {}}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -8111,7 +7991,6 @@ test("class A { static get foo() {} get foo() {}}", {
end: {line: 1, column: 42}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -8178,7 +8057,6 @@ test("class A { static get foo() {} static get bar() {} }", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -8187,7 +8065,6 @@ test("class A { static get foo() {} static get bar() {} }", {
end: {line: 1, column: 29}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -8217,7 +8094,6 @@ test("class A { static get foo() {} static get bar() {} }", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -8226,7 +8102,6 @@ test("class A { static get foo() {} static get bar() {} }", {
end: {line: 1, column: 49}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -8293,7 +8168,6 @@ test("class A { static get foo() {} static set foo(v) {} get foo() {} set foo(v)
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -8302,7 +8176,6 @@ test("class A { static get foo() {} static set foo(v) {} get foo() {} set foo(v)
end: {line: 1, column: 29}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -8339,7 +8212,6 @@ test("class A { static get foo() {} static set foo(v) {} get foo() {} set foo(v)
end: {line: 1, column: 46}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -8348,7 +8220,6 @@ test("class A { static get foo() {} static set foo(v) {} get foo() {} set foo(v)
end: {line: 1, column: 50}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -8378,7 +8249,6 @@ test("class A { static get foo() {} static set foo(v) {} get foo() {} set foo(v)
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -8387,7 +8257,6 @@ test("class A { static get foo() {} static set foo(v) {} get foo() {} set foo(v)
end: {line: 1, column: 63}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -8424,7 +8293,6 @@ test("class A { static get foo() {} static set foo(v) {} get foo() {} set foo(v)
end: {line: 1, column: 73}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -8433,7 +8301,6 @@ test("class A { static get foo() {} static set foo(v) {} get foo() {} set foo(v)
end: {line: 1, column: 77}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -8522,8 +8389,6 @@ test("class A { static [foo]() {} }", {
},
id: null,
params: [],
- defaults: [],
- rest: null,
generator: false,
body: {
type: "BlockStatement",
@@ -8600,8 +8465,6 @@ test("class A { static get [foo]() {} }", {
},
id: null,
params: [],
- defaults: [],
- rest: null,
generator: false,
body: {
type: "BlockStatement",
@@ -8660,7 +8523,6 @@ test("class A { set foo(v) {} get foo() {} }", {
end: {line: 1, column: 19}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -8669,7 +8531,6 @@ test("class A { set foo(v) {} get foo() {} }", {
end: {line: 1, column: 23}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -8699,7 +8560,6 @@ test("class A { set foo(v) {} get foo() {} }", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -8708,7 +8568,6 @@ test("class A { set foo(v) {} get foo() {} }", {
end: {line: 1, column: 36}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -8797,8 +8656,6 @@ test("class A { foo() {} get foo() {} }",{
},
id: null,
params: [],
- defaults: [],
- rest: null,
generator: false,
body: {
type: "BlockStatement",
@@ -8836,8 +8693,6 @@ test("class A { foo() {} get foo() {} }",{
},
id: null,
params: [],
- defaults: [],
- rest: null,
generator: false,
body: {
type: "BlockStatement",
@@ -9043,7 +8898,6 @@ test("({[x]: function() {}})", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -9052,7 +8906,6 @@ test("({[x]: function() {}})", {
end: {line: 1, column: 20}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -9194,7 +9047,6 @@ test("({get [x]() {}, set [x](v) {}})", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -9203,7 +9055,6 @@ test("({get [x]() {}, set [x](v) {}})", {
end: {line: 1, column: 14}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -9241,7 +9092,6 @@ test("({get [x]() {}, set [x](v) {}})", {
end: {line: 1, column: 25}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -9250,7 +9100,6 @@ test("({get [x]() {}, set [x](v) {}})", {
end: {line: 1, column: 29}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -9308,7 +9157,6 @@ test("({[x]() {}})", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -9317,7 +9165,6 @@ test("({[x]() {}})", {
end: {line: 1, column: 10}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -9495,7 +9342,6 @@ test("function f({[x]: y}) {}", {
end: {line: 1, column: 19}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -9504,7 +9350,6 @@ test("function f({[x]: y}) {}", {
end: {line: 1, column: 23}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -9552,7 +9397,6 @@ test("var x = {*[test]() { yield *v; }}", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -9583,7 +9427,6 @@ test("var x = {*[test]() { yield *v; }}", {
end: {line: 1, column: 32}
}
},
- rest: null,
generator: true,
expression: false,
loc: {
@@ -9678,8 +9521,6 @@ test("class A {[x]() {}}", {
},
id: null,
params: [],
- defaults: [],
- rest: null,
generator: false,
body: {
type: "BlockStatement",
@@ -9717,34 +9558,37 @@ test("function f([x] = [1]) {}", {
}
},
params: [{
- type: "ArrayPattern",
- elements: [{
- type: "Identifier",
- name: "x",
+ type: "AssignmentPattern",
+ left: {
+ type: "ArrayPattern",
+ elements: [{
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 12},
+ end: {line: 1, column: 13}
+ }
+ }],
loc: {
- start: {line: 1, column: 12},
- end: {line: 1, column: 13}
+ start: {line: 1, column: 11},
+ end: {line: 1, column: 14}
}
- }],
- loc: {
- start: {line: 1, column: 11},
- end: {line: 1, column: 14}
- }
- }],
- defaults: [{
- type: "ArrayExpression",
- elements: [{
- type: "Literal",
- value: 1,
- raw: "1",
+ },
+ right: {
+ type: "ArrayExpression",
+ elements: [{
+ type: "Literal",
+ value: 1,
+ raw: "1",
+ loc: {
+ start: {line: 1, column: 18},
+ end: {line: 1, column: 19}
+ }
+ }],
loc: {
- start: {line: 1, column: 18},
- end: {line: 1, column: 19}
+ start: {line: 1, column: 17},
+ end: {line: 1, column: 20}
}
- }],
- loc: {
- start: {line: 1, column: 17},
- end: {line: 1, column: 20}
}
}],
body: {
@@ -9755,7 +9599,6 @@ test("function f([x] = [1]) {}", {
end: {line: 1, column: 24}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -9786,72 +9629,75 @@ test("function f({x} = {x: 10}) {}", {
}
},
params: [{
- type: "ObjectPattern",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {line: 1, column: 12},
- end: {line: 1, column: 13}
- }
- },
- value: {
- type: "Identifier",
- name: "x",
+ type: "AssignmentPattern",
+ left: {
+ type: "ObjectPattern",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 12},
+ end: {line: 1, column: 13}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 12},
+ end: {line: 1, column: 13}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: true,
+ computed: false,
loc: {
start: {line: 1, column: 12},
end: {line: 1, column: 13}
}
- },
- kind: "init",
- method: false,
- shorthand: true,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 12},
- end: {line: 1, column: 13}
+ start: {line: 1, column: 11},
+ end: {line: 1, column: 14}
}
- }],
- loc: {
- start: {line: 1, column: 11},
- end: {line: 1, column: 14}
- }
- }],
- defaults: [{
- type: "ObjectExpression",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
+ },
+ right: {
+ type: "ObjectExpression",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 18},
+ end: {line: 1, column: 19}
+ }
+ },
+ value: {
+ type: "Literal",
+ value: 10,
+ raw: "10",
+ loc: {
+ start: {line: 1, column: 21},
+ end: {line: 1, column: 23}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: false,
+ computed: false,
loc: {
start: {line: 1, column: 18},
- end: {line: 1, column: 19}
- }
- },
- value: {
- type: "Literal",
- value: 10,
- raw: "10",
- loc: {
- start: {line: 1, column: 21},
end: {line: 1, column: 23}
}
- },
- kind: "init",
- method: false,
- shorthand: false,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 18},
- end: {line: 1, column: 23}
+ start: {line: 1, column: 17},
+ end: {line: 1, column: 24}
}
- }],
- loc: {
- start: {line: 1, column: 17},
- end: {line: 1, column: 24}
}
}],
body: {
@@ -9862,7 +9708,6 @@ test("function f({x} = {x: 10}) {}", {
end: {line: 1, column: 28}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -9899,72 +9744,75 @@ test("f = function({x} = {x: 10}) {}", {
type: "FunctionExpression",
id: null,
params: [{
- type: "ObjectPattern",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {line: 1, column: 14},
- end: {line: 1, column: 15}
- }
- },
- value: {
- type: "Identifier",
- name: "x",
+ type: "AssignmentPattern",
+ left: {
+ type: "ObjectPattern",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 14},
+ end: {line: 1, column: 15}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 14},
+ end: {line: 1, column: 15}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: true,
+ computed: false,
loc: {
start: {line: 1, column: 14},
end: {line: 1, column: 15}
}
- },
- kind: "init",
- method: false,
- shorthand: true,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 14},
- end: {line: 1, column: 15}
+ start: {line: 1, column: 13},
+ end: {line: 1, column: 16}
}
- }],
- loc: {
- start: {line: 1, column: 13},
- end: {line: 1, column: 16}
- }
- }],
- defaults: [{
- type: "ObjectExpression",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
+ },
+ right: {
+ type: "ObjectExpression",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 20},
+ end: {line: 1, column: 21}
+ }
+ },
+ value: {
+ type: "Literal",
+ value: 10,
+ raw: "10",
+ loc: {
+ start: {line: 1, column: 23},
+ end: {line: 1, column: 25}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: false,
+ computed: false,
loc: {
start: {line: 1, column: 20},
- end: {line: 1, column: 21}
- }
- },
- value: {
- type: "Literal",
- value: 10,
- raw: "10",
- loc: {
- start: {line: 1, column: 23},
end: {line: 1, column: 25}
}
- },
- kind: "init",
- method: false,
- shorthand: false,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 20},
- end: {line: 1, column: 25}
+ start: {line: 1, column: 19},
+ end: {line: 1, column: 26}
}
- }],
- loc: {
- start: {line: 1, column: 19},
- end: {line: 1, column: 26}
}
}],
body: {
@@ -9975,7 +9823,6 @@ test("f = function({x} = {x: 10}) {}", {
end: {line: 1, column: 30}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -10023,72 +9870,75 @@ test("({f: function({x} = {x: 10}) {}})", {
type: "FunctionExpression",
id: null,
params: [{
- type: "ObjectPattern",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {line: 1, column: 15},
- end: {line: 1, column: 16}
- }
- },
- value: {
- type: "Identifier",
- name: "x",
+ type: "AssignmentPattern",
+ left: {
+ type: "ObjectPattern",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 15},
+ end: {line: 1, column: 16}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 15},
+ end: {line: 1, column: 16}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: true,
+ computed: false,
loc: {
start: {line: 1, column: 15},
end: {line: 1, column: 16}
}
- },
- kind: "init",
- method: false,
- shorthand: true,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 15},
- end: {line: 1, column: 16}
+ start: {line: 1, column: 14},
+ end: {line: 1, column: 17}
}
- }],
- loc: {
- start: {line: 1, column: 14},
- end: {line: 1, column: 17}
- }
- }],
- defaults: [{
- type: "ObjectExpression",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
+ },
+ right: {
+ type: "ObjectExpression",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 21},
+ end: {line: 1, column: 22}
+ }
+ },
+ value: {
+ type: "Literal",
+ value: 10,
+ raw: "10",
+ loc: {
+ start: {line: 1, column: 24},
+ end: {line: 1, column: 26}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: false,
+ computed: false,
loc: {
start: {line: 1, column: 21},
- end: {line: 1, column: 22}
- }
- },
- value: {
- type: "Literal",
- value: 10,
- raw: "10",
- loc: {
- start: {line: 1, column: 24},
end: {line: 1, column: 26}
}
- },
- kind: "init",
- method: false,
- shorthand: false,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 21},
- end: {line: 1, column: 26}
+ start: {line: 1, column: 20},
+ end: {line: 1, column: 27}
}
- }],
- loc: {
- start: {line: 1, column: 20},
- end: {line: 1, column: 27}
}
}],
body: {
@@ -10099,7 +9949,6 @@ test("({f: function({x} = {x: 10}) {}})", {
end: {line: 1, column: 31}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -10156,72 +10005,75 @@ test("({f({x} = {x: 10}) {}})", {
type: "FunctionExpression",
id: null,
params: [{
- type: "ObjectPattern",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {line: 1, column: 5},
- end: {line: 1, column: 6}
- }
- },
- value: {
- type: "Identifier",
- name: "x",
+ type: "AssignmentPattern",
+ left: {
+ type: "ObjectPattern",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 5},
+ end: {line: 1, column: 6}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 5},
+ end: {line: 1, column: 6}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: true,
+ computed: false,
loc: {
start: {line: 1, column: 5},
end: {line: 1, column: 6}
}
- },
- kind: "init",
- method: false,
- shorthand: true,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 5},
- end: {line: 1, column: 6}
+ start: {line: 1, column: 4},
+ end: {line: 1, column: 7}
}
- }],
- loc: {
- start: {line: 1, column: 4},
- end: {line: 1, column: 7}
- }
- }],
- defaults: [{
- type: "ObjectExpression",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {line: 1, column: 11},
- end: {line: 1, column: 12}
- }
- },
- value: {
- type: "Literal",
- value: 10,
- raw: "10",
+ },
+ right: {
+ type: "ObjectExpression",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 11},
+ end: {line: 1, column: 12}
+ }
+ },
+ value: {
+ type: "Literal",
+ value: 10,
+ raw: "10",
+ loc: {
+ start: {line: 1, column: 14},
+ end: {line: 1, column: 16}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: false,
+ computed: false,
loc: {
- start: {line: 1, column: 14},
+ start: {line: 1, column: 11},
end: {line: 1, column: 16}
}
- },
- kind: "init",
- method: false,
- shorthand: false,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 11},
- end: {line: 1, column: 16}
+ start: {line: 1, column: 10},
+ end: {line: 1, column: 17}
}
- }],
- loc: {
- start: {line: 1, column: 10},
- end: {line: 1, column: 17}
}
}],
body: {
@@ -10232,7 +10084,6 @@ test("({f({x} = {x: 10}) {}})", {
end: {line: 1, column: 21}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -10293,72 +10144,75 @@ test("(class {f({x} = {x: 10}) {}})", {
type: "FunctionExpression",
id: null,
params: [{
- type: "ObjectPattern",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {line: 1, column: 11},
- end: {line: 1, column: 12}
- }
- },
- value: {
- type: "Identifier",
- name: "x",
+ type: "AssignmentPattern",
+ left: {
+ type: "ObjectPattern",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 11},
+ end: {line: 1, column: 12}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 11},
+ end: {line: 1, column: 12}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: true,
+ computed: false,
loc: {
start: {line: 1, column: 11},
end: {line: 1, column: 12}
}
- },
- kind: "init",
- method: false,
- shorthand: true,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 11},
- end: {line: 1, column: 12}
+ start: {line: 1, column: 10},
+ end: {line: 1, column: 13}
}
- }],
- loc: {
- start: {line: 1, column: 10},
- end: {line: 1, column: 13}
- }
- }],
- defaults: [{
- type: "ObjectExpression",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
+ },
+ right: {
+ type: "ObjectExpression",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 17},
+ end: {line: 1, column: 18}
+ }
+ },
+ value: {
+ type: "Literal",
+ value: 10,
+ raw: "10",
+ loc: {
+ start: {line: 1, column: 20},
+ end: {line: 1, column: 22}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: false,
+ computed: false,
loc: {
start: {line: 1, column: 17},
- end: {line: 1, column: 18}
- }
- },
- value: {
- type: "Literal",
- value: 10,
- raw: "10",
- loc: {
- start: {line: 1, column: 20},
end: {line: 1, column: 22}
}
- },
- kind: "init",
- method: false,
- shorthand: false,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 17},
- end: {line: 1, column: 22}
+ start: {line: 1, column: 16},
+ end: {line: 1, column: 23}
}
- }],
- loc: {
- start: {line: 1, column: 16},
- end: {line: 1, column: 23}
}
}],
body: {
@@ -10369,7 +10223,6 @@ test("(class {f({x} = {x: 10}) {}})", {
end: {line: 1, column: 27}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -10417,72 +10270,75 @@ test("(({x} = {x: 10}) => {})", {
type: "ArrowFunctionExpression",
id: null,
params: [{
- type: "ObjectPattern",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
- loc: {
- start: {line: 1, column: 3},
- end: {line: 1, column: 4}
- }
- },
- value: {
- type: "Identifier",
- name: "x",
+ type: "AssignmentPattern",
+ left: {
+ type: "ObjectPattern",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 3},
+ end: {line: 1, column: 4}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 3},
+ end: {line: 1, column: 4}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: true,
+ computed: false,
loc: {
start: {line: 1, column: 3},
end: {line: 1, column: 4}
}
- },
- kind: "init",
- method: false,
- shorthand: true,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 3},
- end: {line: 1, column: 4}
+ start: {line: 1, column: 2},
+ end: {line: 1, column: 5}
}
- }],
- loc: {
- start: {line: 1, column: 2},
- end: {line: 1, column: 5}
- }
- }],
- defaults: [{
- type: "ObjectExpression",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "x",
+ },
+ right: {
+ type: "ObjectExpression",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 9},
+ end: {line: 1, column: 10}
+ }
+ },
+ value: {
+ type: "Literal",
+ value: 10,
+ raw: "10",
+ loc: {
+ start: {line: 1, column: 12},
+ end: {line: 1, column: 14}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: false,
+ computed: false,
loc: {
start: {line: 1, column: 9},
- end: {line: 1, column: 10}
- }
- },
- value: {
- type: "Literal",
- value: 10,
- raw: "10",
- loc: {
- start: {line: 1, column: 12},
end: {line: 1, column: 14}
}
- },
- kind: "init",
- method: false,
- shorthand: false,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 9},
- end: {line: 1, column: 14}
+ start: {line: 1, column: 8},
+ end: {line: 1, column: 15}
}
- }],
- loc: {
- start: {line: 1, column: 8},
- end: {line: 1, column: 15}
}
}],
body: {
@@ -10493,7 +10349,6 @@ test("(({x} = {x: 10}) => {})", {
end: {line: 1, column: 22}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -10535,22 +10390,25 @@ test("x = function(y = 1) {}", {
type: "FunctionExpression",
id: null,
params: [{
- type: "Identifier",
- name: "y",
- loc: {
- start: {line: 1, column: 13},
- end: {line: 1, column: 14}
- }
- }],
- defaults: [{
- type: "Literal",
- value: 1,
- raw: "1",
- loc: {
- start: {line: 1, column: 17},
- end: {line: 1, column: 18}
- }
- }],
+ type: "AssignmentPattern",
+ left: {
+ type: "Identifier",
+ name: "y",
+ loc: {
+ start: {line: 1, column: 13},
+ end: {line: 1, column: 14}
+ }
+ },
+ right: {
+ type: "Literal",
+ value: 1,
+ raw: "1",
+ loc: {
+ start: {line: 1, column: 17},
+ end: {line: 1, column: 18}
+ }
+ }
+ }],
body: {
type: "BlockStatement",
body: [],
@@ -10559,7 +10417,6 @@ test("x = function(y = 1) {}", {
end: {line: 1, column: 22}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -10600,20 +10457,23 @@ test("function f(a = 1) {}", {
}
},
params: [{
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 11},
- end: {line: 1, column: 12}
- }
- }],
- defaults: [{
- type: "Literal",
- value: 1,
- raw: "1",
- loc: {
- start: {line: 1, column: 15},
- end: {line: 1, column: 16}
+ type: "AssignmentPattern",
+ left: {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 11},
+ end: {line: 1, column: 12}
+ }
+ },
+ right: {
+ type: "Literal",
+ value: 1,
+ raw: "1",
+ loc: {
+ start: {line: 1, column: 15},
+ end: {line: 1, column: 16}
+ }
}
}],
body: {
@@ -10624,7 +10484,6 @@ test("function f(a = 1) {}", {
end: {line: 1, column: 20}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -10673,20 +10532,23 @@ test("x = { f: function(a=1) {} }", {
type: "FunctionExpression",
id: null,
params: [{
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 18},
- end: {line: 1, column: 19}
- }
- }],
- defaults: [{
- type: "Literal",
- value: 1,
- raw: "1",
- loc: {
- start: {line: 1, column: 20},
- end: {line: 1, column: 21}
+ type: "AssignmentPattern",
+ left: {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 18},
+ end: {line: 1, column: 19}
+ }
+ },
+ right: {
+ type: "Literal",
+ value: 1,
+ raw: "1",
+ loc: {
+ start: {line: 1, column: 20},
+ end: {line: 1, column: 21}
+ }
}
}],
body: {
@@ -10697,7 +10559,6 @@ test("x = { f: function(a=1) {} }", {
end: {line: 1, column: 25}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -10770,20 +10631,23 @@ test("x = { f(a=1) {} }", {
type: "FunctionExpression",
id: null,
params: [{
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 8},
- end: {line: 1, column: 9}
- }
- }],
- defaults: [{
- type: "Literal",
- value: 1,
- raw: "1",
- loc: {
- start: {line: 1, column: 10},
- end: {line: 1, column: 11}
+ type: "AssignmentPattern",
+ left: {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 8},
+ end: {line: 1, column: 9}
+ }
+ },
+ right: {
+ type: "Literal",
+ value: 1,
+ raw: "1",
+ loc: {
+ start: {line: 1, column: 10},
+ end: {line: 1, column: 11}
+ }
}
}],
body: {
@@ -10794,7 +10658,6 @@ test("x = { f(a=1) {} }", {
end: {line: 1, column: 15}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -10850,15 +10713,27 @@ test("function f(a, ...b) {}", {
end: {line: 1, column: 10}
}
},
- params: [{
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 11},
- end: {line: 1, column: 12}
+ params: [
+ {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 11},
+ end: {line: 1, column: 12}
+ }
+ },
+ {
+ type: "RestElement",
+ argument: {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 17},
+ end: {line: 1, column: 18}
+ }
+ }
}
- }],
- defaults: [],
+ ],
body: {
type: "BlockStatement",
body: [],
@@ -10867,14 +10742,6 @@ test("function f(a, ...b) {}", {
end: {line: 1, column: 22}
}
},
- rest: {
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 17},
- end: {line: 1, column: 18}
- }
- },
generator: false,
expression: false,
loc: {
@@ -10931,7 +10798,6 @@ test("function x([ a, b ]){}", {
end: {line: 1, column: 19}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -10940,7 +10806,6 @@ test("function x([ a, b ]){}", {
end: {line: 1, column: 22}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -11033,7 +10898,6 @@ test("function x({ a, b }){}", {
end: {line: 1, column: 19}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -11042,7 +10906,6 @@ test("function x({ a, b }){}", {
end: {line: 1, column: 22}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -11116,7 +10979,6 @@ test("function x(a, { a }){}", {
}
}
],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -11125,7 +10987,6 @@ test("function x(a, { a }){}", {
end: {line: 1, column: 22}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -11155,8 +11016,34 @@ test("function x(...[ a, b ]){}", {
end: {line: 1, column: 10}
}
},
- params: [],
- defaults: [],
+ params: [{
+ type: "RestElement",
+ argument: {
+ type: "ArrayPattern",
+ elements: [
+ {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 16},
+ end: {line: 1, column: 17}
+ }
+ },
+ {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 19},
+ end: {line: 1, column: 20}
+ }
+ }
+ ],
+ loc: {
+ start: {line: 1, column: 14},
+ end: {line: 1, column: 22}
+ }
+ }
+ }],
body: {
type: "BlockStatement",
body: [],
@@ -11165,31 +11052,6 @@ test("function x(...[ a, b ]){}", {
end: {line: 1, column: 25}
}
},
- rest: {
- type: "ArrayPattern",
- elements: [
- {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 16},
- end: {line: 1, column: 17}
- }
- },
- {
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 19},
- end: {line: 1, column: 20}
- }
- }
- ],
- loc: {
- start: {line: 1, column: 14},
- end: {line: 1, column: 22}
- }
- },
generator: false,
expression: false,
loc: {
@@ -11219,142 +11081,179 @@ test("function x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){}", {
end: {line: 1, column: 10}
}
},
- params: [{
- type: "ObjectPattern",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 13},
- end: {line: 1, column: 14}
- }
- },
- value: {
- type: "ObjectPattern",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "w",
+ params: [
+ {
+ type: "ObjectPattern",
+ properties: [
+ {
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 13},
+ end: {line: 1, column: 14}
+ }
+ },
+ value: {
+ type: "ObjectPattern",
+ properties: [
+ {
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "w",
+ loc: {
+ start: {line: 1, column: 18},
+ end: {line: 1, column: 19}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "w",
+ loc: {
+ start: {line: 1, column: 18},
+ end: {line: 1, column: 19}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: true,
+ computed: false,
loc: {
start: {line: 1, column: 18},
end: {line: 1, column: 19}
}
},
- value: {
- type: "Identifier",
- name: "w",
+ {
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 21},
+ end: {line: 1, column: 22}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 21},
+ end: {line: 1, column: 22}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: true,
+ computed: false,
loc: {
- start: {line: 1, column: 18},
- end: {line: 1, column: 19}
+ start: {line: 1, column: 21},
+ end: {line: 1, column: 22}
}
- },
- kind: "init",
- method: false,
- shorthand: true,
- computed: false,
- loc: {
- start: {line: 1, column: 18},
- end: {line: 1, column: 19}
}
- },
- {
- type: "Property",
- key: {
+ ],
+ loc: {
+ start: {line: 1, column: 16},
+ end: {line: 1, column: 24}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: false,
+ computed: false,
+ loc: {
+ start: {line: 1, column: 13},
+ end: {line: 1, column: 24}
+ }
+ },
+ {
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 26},
+ end: {line: 1, column: 27}
+ }
+ },
+ value: {
+ type: "ArrayPattern",
+ elements: [
+ {
type: "Identifier",
- name: "x",
+ name: "y",
loc: {
- start: {line: 1, column: 21},
- end: {line: 1, column: 22}
+ start: {line: 1, column: 30},
+ end: {line: 1, column: 31}
}
},
- value: {
+ {
type: "Identifier",
- name: "x",
+ name: "z",
loc: {
- start: {line: 1, column: 21},
- end: {line: 1, column: 22}
+ start: {line: 1, column: 33},
+ end: {line: 1, column: 34}
}
- },
- kind: "init",
- method: false,
- shorthand: true,
- computed: false,
- loc: {
- start: {line: 1, column: 21},
- end: {line: 1, column: 22}
}
+ ],
+ loc: {
+ start: {line: 1, column: 29},
+ end: {line: 1, column: 35}
}
- ],
- loc: {
- start: {line: 1, column: 16},
- end: {line: 1, column: 24}
- }
- },
- kind: "init",
- method: false,
- shorthand: false,
- computed: false,
- loc: {
- start: {line: 1, column: 13},
- end: {line: 1, column: 24}
- }
- },
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "b",
+ },
+ kind: "init",
+ method: false,
+ shorthand: false,
+ computed: false,
loc: {
start: {line: 1, column: 26},
- end: {line: 1, column: 27}
+ end: {line: 1, column: 35}
}
- },
- value: {
- type: "ArrayPattern",
- elements: [
- {
- type: "Identifier",
- name: "y",
- loc: {
- start: {line: 1, column: 30},
- end: {line: 1, column: 31}
- }
- },
- {
- type: "Identifier",
- name: "z",
- loc: {
- start: {line: 1, column: 33},
- end: {line: 1, column: 34}
- }
+ }
+ ],
+ loc: {
+ start: {line: 1, column: 11},
+ end: {line: 1, column: 37}
+ }
+ },
+ {
+ type: "RestElement",
+ argument: {
+ type: "ArrayPattern",
+ elements: [
+ {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 43},
+ end: {line: 1, column: 44}
+ }
+ },
+ {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 46},
+ end: {line: 1, column: 47}
+ }
+ },
+ {
+ type: "Identifier",
+ name: "c",
+ loc: {
+ start: {line: 1, column: 49},
+ end: {line: 1, column: 50}
}
- ],
- loc: {
- start: {line: 1, column: 29},
- end: {line: 1, column: 35}
}
- },
- kind: "init",
- method: false,
- shorthand: false,
- computed: false,
+ ],
loc: {
- start: {line: 1, column: 26},
- end: {line: 1, column: 35}
+ start: {line: 1, column: 42},
+ end: {line: 1, column: 51}
}
}
- ],
- loc: {
- start: {line: 1, column: 11},
- end: {line: 1, column: 37}
}
- }],
- defaults: [],
+ ],
body: {
type: "BlockStatement",
body: [],
@@ -11363,39 +11262,6 @@ test("function x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){}", {
end: {line: 1, column: 54}
}
},
- rest: {
- type: "ArrayPattern",
- elements: [
- {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 43},
- end: {line: 1, column: 44}
- }
- },
- {
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 46},
- end: {line: 1, column: 47}
- }
- },
- {
- type: "Identifier",
- name: "c",
- loc: {
- start: {line: 1, column: 49},
- end: {line: 1, column: 50}
- }
- }
- ],
- loc: {
- start: {line: 1, column: 42},
- end: {line: 1, column: 51}
- }
- },
generator: false,
expression: false,
loc: {
@@ -11452,7 +11318,6 @@ test("(function x([ a, b ]){})", {
end: {line: 1, column: 20}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -11461,7 +11326,6 @@ test("(function x([ a, b ]){})", {
end: {line: 1, column: 23}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -11561,7 +11425,6 @@ test("(function x({ a, b }){})", {
end: {line: 1, column: 20}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -11570,7 +11433,6 @@ test("(function x({ a, b }){})", {
end: {line: 1, column: 23}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -11607,8 +11469,34 @@ test("(function x(...[ a, b ]){})", {
end: {line: 1, column: 11}
}
},
- params: [],
- defaults: [],
+ params: [{
+ type: "RestElement",
+ argument: {
+ type: "ArrayPattern",
+ elements: [
+ {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 17},
+ end: {line: 1, column: 18}
+ }
+ },
+ {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 20},
+ end: {line: 1, column: 21}
+ }
+ }
+ ],
+ loc: {
+ start: {line: 1, column: 15},
+ end: {line: 1, column: 23}
+ }
+ }
+ }],
body: {
type: "BlockStatement",
body: [],
@@ -11617,31 +11505,6 @@ test("(function x(...[ a, b ]){})", {
end: {line: 1, column: 26}
}
},
- rest: {
- type: "ArrayPattern",
- elements: [
- {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 17},
- end: {line: 1, column: 18}
- }
- },
- {
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 20},
- end: {line: 1, column: 21}
- }
- }
- ],
- loc: {
- start: {line: 1, column: 15},
- end: {line: 1, column: 23}
- }
- },
generator: false,
expression: false,
loc: {
@@ -11678,142 +11541,179 @@ test("(function x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){})", {
end: {line: 1, column: 11}
}
},
- params: [{
- type: "ObjectPattern",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 14},
- end: {line: 1, column: 15}
- }
- },
- value: {
- type: "ObjectPattern",
- properties: [
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "w",
+ params: [
+ {
+ type: "ObjectPattern",
+ properties: [
+ {
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 14},
+ end: {line: 1, column: 15}
+ }
+ },
+ value: {
+ type: "ObjectPattern",
+ properties: [
+ {
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "w",
+ loc: {
+ start: {line: 1, column: 19},
+ end: {line: 1, column: 20}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "w",
+ loc: {
+ start: {line: 1, column: 19},
+ end: {line: 1, column: 20}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: true,
+ computed: false,
loc: {
start: {line: 1, column: 19},
end: {line: 1, column: 20}
}
},
- value: {
- type: "Identifier",
- name: "w",
+ {
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 22},
+ end: {line: 1, column: 23}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "x",
+ loc: {
+ start: {line: 1, column: 22},
+ end: {line: 1, column: 23}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: true,
+ computed: false,
loc: {
- start: {line: 1, column: 19},
- end: {line: 1, column: 20}
+ start: {line: 1, column: 22},
+ end: {line: 1, column: 23}
}
- },
- kind: "init",
- method: false,
- shorthand: true,
- computed: false,
- loc: {
- start: {line: 1, column: 19},
- end: {line: 1, column: 20}
}
- },
- {
- type: "Property",
- key: {
+ ],
+ loc: {
+ start: {line: 1, column: 17},
+ end: {line: 1, column: 25}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: false,
+ computed: false,
+ loc: {
+ start: {line: 1, column: 14},
+ end: {line: 1, column: 25}
+ }
+ },
+ {
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 27},
+ end: {line: 1, column: 28}
+ }
+ },
+ value: {
+ type: "ArrayPattern",
+ elements: [
+ {
type: "Identifier",
- name: "x",
+ name: "y",
loc: {
- start: {line: 1, column: 22},
- end: {line: 1, column: 23}
+ start: {line: 1, column: 31},
+ end: {line: 1, column: 32}
}
},
- value: {
+ {
type: "Identifier",
- name: "x",
+ name: "z",
loc: {
- start: {line: 1, column: 22},
- end: {line: 1, column: 23}
+ start: {line: 1, column: 34},
+ end: {line: 1, column: 35}
}
- },
- kind: "init",
- method: false,
- shorthand: true,
- computed: false,
- loc: {
- start: {line: 1, column: 22},
- end: {line: 1, column: 23}
}
+ ],
+ loc: {
+ start: {line: 1, column: 30},
+ end: {line: 1, column: 36}
}
- ],
- loc: {
- start: {line: 1, column: 17},
- end: {line: 1, column: 25}
- }
- },
- kind: "init",
- method: false,
- shorthand: false,
- computed: false,
- loc: {
- start: {line: 1, column: 14},
- end: {line: 1, column: 25}
- }
- },
- {
- type: "Property",
- key: {
- type: "Identifier",
- name: "b",
+ },
+ kind: "init",
+ method: false,
+ shorthand: false,
+ computed: false,
loc: {
start: {line: 1, column: 27},
- end: {line: 1, column: 28}
+ end: {line: 1, column: 36}
}
- },
- value: {
- type: "ArrayPattern",
- elements: [
- {
- type: "Identifier",
- name: "y",
- loc: {
- start: {line: 1, column: 31},
- end: {line: 1, column: 32}
- }
- },
- {
- type: "Identifier",
- name: "z",
- loc: {
- start: {line: 1, column: 34},
- end: {line: 1, column: 35}
- }
+ }
+ ],
+ loc: {
+ start: {line: 1, column: 12},
+ end: {line: 1, column: 38}
+ }
+ },
+ {
+ type: "RestElement",
+ argument: {
+ type: "ArrayPattern",
+ elements: [
+ {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 44},
+ end: {line: 1, column: 45}
+ }
+ },
+ {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 47},
+ end: {line: 1, column: 48}
+ }
+ },
+ {
+ type: "Identifier",
+ name: "c",
+ loc: {
+ start: {line: 1, column: 50},
+ end: {line: 1, column: 51}
}
- ],
- loc: {
- start: {line: 1, column: 30},
- end: {line: 1, column: 36}
}
- },
- kind: "init",
- method: false,
- shorthand: false,
- computed: false,
+ ],
loc: {
- start: {line: 1, column: 27},
- end: {line: 1, column: 36}
+ start: {line: 1, column: 43},
+ end: {line: 1, column: 52}
}
}
- ],
- loc: {
- start: {line: 1, column: 12},
- end: {line: 1, column: 38}
}
- }],
- defaults: [],
+ ],
body: {
type: "BlockStatement",
body: [],
@@ -11822,39 +11722,6 @@ test("(function x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){})", {
end: {line: 1, column: 55}
}
},
- rest: {
- type: "ArrayPattern",
- elements: [
- {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 44},
- end: {line: 1, column: 45}
- }
- },
- {
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 47},
- end: {line: 1, column: 48}
- }
- },
- {
- type: "Identifier",
- name: "c",
- loc: {
- start: {line: 1, column: 50},
- end: {line: 1, column: 51}
- }
- }
- ],
- loc: {
- start: {line: 1, column: 43},
- end: {line: 1, column: 52}
- }
- },
generator: false,
expression: false,
loc: {
@@ -11921,7 +11788,6 @@ test("({ x([ a, b ]){} })", {
end: {line: 1, column: 13}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -11930,7 +11796,6 @@ test("({ x([ a, b ]){} })", {
end: {line: 1, column: 16}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -11986,8 +11851,34 @@ test("({ x(...[ a, b ]){} })", {
value: {
type: "FunctionExpression",
id: null,
- params: [],
- defaults: [],
+ params: [{
+ type: "RestElement",
+ argument: {
+ type: "ArrayPattern",
+ elements: [
+ {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 10},
+ end: {line: 1, column: 11}
+ }
+ },
+ {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 13},
+ end: {line: 1, column: 14}
+ }
+ }
+ ],
+ loc: {
+ start: {line: 1, column: 8},
+ end: {line: 1, column: 16}
+ }
+ }
+ }],
body: {
type: "BlockStatement",
body: [],
@@ -11996,31 +11887,6 @@ test("({ x(...[ a, b ]){} })", {
end: {line: 1, column: 19}
}
},
- rest: {
- type: "ArrayPattern",
- elements: [
- {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 10},
- end: {line: 1, column: 11}
- }
- },
- {
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 13},
- end: {line: 1, column: 14}
- }
- }
- ],
- loc: {
- start: {line: 1, column: 8},
- end: {line: 1, column: 16}
- }
- },
generator: false,
expression: false,
loc: {
@@ -12076,7 +11942,8 @@ test("({ x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){} })", {
value: {
type: "FunctionExpression",
id: null,
- params: [{
+ params: [
+ {
type: "ObjectPattern",
properties: [
{
@@ -12210,8 +12077,44 @@ test("({ x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){} })", {
start: {line: 1, column: 5},
end: {line: 1, column: 31}
}
- }],
- defaults: [],
+ },
+ {
+ type: "RestElement",
+ argument: {
+ type: "ArrayPattern",
+ elements: [
+ {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 37},
+ end: {line: 1, column: 38}
+ }
+ },
+ {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 40},
+ end: {line: 1, column: 41}
+ }
+ },
+ {
+ type: "Identifier",
+ name: "c",
+ loc: {
+ start: {line: 1, column: 43},
+ end: {line: 1, column: 44}
+ }
+ }
+ ],
+ loc: {
+ start: {line: 1, column: 36},
+ end: {line: 1, column: 45}
+ }
+ }
+ }
+ ],
body: {
type: "BlockStatement",
body: [],
@@ -12220,39 +12123,6 @@ test("({ x({ a: { w, x }, b: [y, z] }, ...[a, b, c]){} })", {
end: {line: 1, column: 48}
}
},
- rest: {
- type: "ArrayPattern",
- elements: [
- {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 37},
- end: {line: 1, column: 38}
- }
- },
- {
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 40},
- end: {line: 1, column: 41}
- }
- },
- {
- type: "Identifier",
- name: "c",
- loc: {
- start: {line: 1, column: 43},
- end: {line: 1, column: 44}
- }
- }
- ],
- loc: {
- start: {line: 1, column: 36},
- end: {line: 1, column: 45}
- }
- },
generator: false,
expression: false,
loc: {
@@ -12296,8 +12166,17 @@ test("(...a) => {}", {
expression: {
type: "ArrowFunctionExpression",
id: null,
- params: [],
- defaults: [],
+ params: [{
+ type: "RestElement",
+ argument: {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 4},
+ end: {line: 1, column: 5}
+ }
+ }
+ }],
body: {
type: "BlockStatement",
body: [],
@@ -12306,14 +12185,6 @@ test("(...a) => {}", {
end: {line: 1, column: 12}
}
},
- rest: {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 4},
- end: {line: 1, column: 5}
- }
- },
generator: false,
expression: false,
loc: {
@@ -12343,15 +12214,27 @@ test("(a, ...b) => {}", {
expression: {
type: "ArrowFunctionExpression",
id: null,
- params: [{
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 1},
- end: {line: 1, column: 2}
+ params: [
+ {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 1},
+ end: {line: 1, column: 2}
+ }
+ },
+ {
+ type: "RestElement",
+ argument: {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 7},
+ end: {line: 1, column: 8}
+ }
+ }
}
- }],
- defaults: [],
+ ],
body: {
type: "BlockStatement",
body: [],
@@ -12360,14 +12243,6 @@ test("(a, ...b) => {}", {
end: {line: 1, column: 15}
}
},
- rest: {
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 7},
- end: {line: 1, column: 8}
- }
- },
generator: false,
expression: false,
loc: {
@@ -12431,7 +12306,6 @@ test("({ a }) => {}", {
end: {line: 1, column: 6}
}
}],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -12440,7 +12314,6 @@ test("({ a }) => {}", {
end: {line: 1, column: 13}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -12470,41 +12343,53 @@ test("({ a }, ...b) => {}", {
expression: {
type: "ArrowFunctionExpression",
id: null,
- params: [{
- type: "ObjectPattern",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "a",
+ params: [
+ {
+ type: "ObjectPattern",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 3},
+ end: {line: 1, column: 4}
+ }
+ },
+ value: {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 3},
+ end: {line: 1, column: 4}
+ }
+ },
+ kind: "init",
+ method: false,
+ shorthand: true,
+ computed: false,
loc: {
start: {line: 1, column: 3},
end: {line: 1, column: 4}
}
- },
- value: {
+ }],
+ loc: {
+ start: {line: 1, column: 1},
+ end: {line: 1, column: 6}
+ }
+ },
+ {
+ type: "RestElement",
+ argument: {
type: "Identifier",
- name: "a",
+ name: "b",
loc: {
- start: {line: 1, column: 3},
- end: {line: 1, column: 4}
+ start: {line: 1, column: 11},
+ end: {line: 1, column: 12}
}
- },
- kind: "init",
- method: false,
- shorthand: true,
- computed: false,
- loc: {
- start: {line: 1, column: 3},
- end: {line: 1, column: 4}
}
- }],
- loc: {
- start: {line: 1, column: 1},
- end: {line: 1, column: 6}
}
- }],
- defaults: [],
+ ],
body: {
type: "BlockStatement",
body: [],
@@ -12513,14 +12398,6 @@ test("({ a }, ...b) => {}", {
end: {line: 1, column: 19}
}
},
- rest: {
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 11},
- end: {line: 1, column: 12}
- }
- },
generator: false,
expression: false,
loc: {
@@ -12550,8 +12427,34 @@ test("(...[a, b]) => {}", {
expression: {
type: "ArrowFunctionExpression",
id: null,
- params: [],
- defaults: [],
+ params: [{
+ type: "RestElement",
+ argument: {
+ type: "ArrayPattern",
+ elements: [
+ {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 5},
+ end: {line: 1, column: 6}
+ }
+ },
+ {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 8},
+ end: {line: 1, column: 9}
+ }
+ }
+ ],
+ loc: {
+ start: {line: 1, column: 4},
+ end: {line: 1, column: 10}
+ }
+ }
+ }],
body: {
type: "BlockStatement",
body: [],
@@ -12560,31 +12463,6 @@ test("(...[a, b]) => {}", {
end: {line: 1, column: 17}
}
},
- rest: {
- type: "ArrayPattern",
- elements: [
- {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 5},
- end: {line: 1, column: 6}
- }
- },
- {
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 8},
- end: {line: 1, column: 9}
- }
- }
- ],
- loc: {
- start: {line: 1, column: 4},
- end: {line: 1, column: 10}
- }
- },
generator: false,
expression: false,
loc: {
@@ -12614,15 +12492,34 @@ test("(a, ...[b]) => {}", {
expression: {
type: "ArrowFunctionExpression",
id: null,
- params: [{
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 1},
- end: {line: 1, column: 2}
+ params: [
+ {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 1},
+ end: {line: 1, column: 2}
+ }
+ },
+ {
+ type: "RestElement",
+ argument: {
+ type: "ArrayPattern",
+ elements: [{
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 8},
+ end: {line: 1, column: 9}
+ }
+ }],
+ loc: {
+ start: {line: 1, column: 7},
+ end: {line: 1, column: 10}
+ }
+ }
}
- }],
- defaults: [],
+ ],
body: {
type: "BlockStatement",
body: [],
@@ -12631,21 +12528,6 @@ test("(a, ...[b]) => {}", {
end: {line: 1, column: 17}
}
},
- rest: {
- type: "ArrayPattern",
- elements: [{
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 8},
- end: {line: 1, column: 9}
- }
- }],
- loc: {
- start: {line: 1, column: 7},
- end: {line: 1, column: 10}
- }
- },
generator: false,
expression: false,
loc: {
@@ -12675,58 +12557,70 @@ test("({ a: [a, b] }, ...c) => {}", {
expression: {
type: "ArrowFunctionExpression",
id: null,
- params: [{
- type: "ObjectPattern",
- properties: [{
- type: "Property",
- key: {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 3},
- end: {line: 1, column: 4}
- }
- },
- value: {
- type: "ArrayPattern",
- elements: [
- {
- type: "Identifier",
- name: "a",
- loc: {
- start: {line: 1, column: 7},
- end: {line: 1, column: 8}
- }
- },
- {
- type: "Identifier",
- name: "b",
- loc: {
- start: {line: 1, column: 10},
- end: {line: 1, column: 11}
+ params: [
+ {
+ type: "ObjectPattern",
+ properties: [{
+ type: "Property",
+ key: {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 3},
+ end: {line: 1, column: 4}
+ }
+ },
+ value: {
+ type: "ArrayPattern",
+ elements: [
+ {
+ type: "Identifier",
+ name: "a",
+ loc: {
+ start: {line: 1, column: 7},
+ end: {line: 1, column: 8}
+ }
+ },
+ {
+ type: "Identifier",
+ name: "b",
+ loc: {
+ start: {line: 1, column: 10},
+ end: {line: 1, column: 11}
+ }
}
+ ],
+ loc: {
+ start: {line: 1, column: 6},
+ end: {line: 1, column: 12}
}
- ],
+ },
+ kind: "init",
+ method: false,
+ shorthand: false,
+ computed: false,
loc: {
- start: {line: 1, column: 6},
+ start: {line: 1, column: 3},
end: {line: 1, column: 12}
}
- },
- kind: "init",
- method: false,
- shorthand: false,
- computed: false,
+ }],
loc: {
- start: {line: 1, column: 3},
- end: {line: 1, column: 12}
+ start: {line: 1, column: 1},
+ end: {line: 1, column: 14}
+ }
+ },
+ {
+ type: "RestElement",
+ argument: {
+ type: "Identifier",
+ name: "c",
+ loc: {
+ start: {line: 1, column: 19},
+ end: {line: 1, column: 20}
+ }
}
- }],
- loc: {
- start: {line: 1, column: 1},
- end: {line: 1, column: 14}
}
- }],
- defaults: [],
+ ],
body: {
type: "BlockStatement",
body: [],
@@ -12735,14 +12629,6 @@ test("({ a: [a, b] }, ...c) => {}", {
end: {line: 1, column: 27}
}
},
- rest: {
- type: "Identifier",
- name: "c",
- loc: {
- start: {line: 1, column: 19},
- end: {line: 1, column: 20}
- }
- },
generator: false,
expression: false,
loc: {
@@ -12860,9 +12746,19 @@ test("({ a: b, c }, [d, e], ...f) => {}", {
start: {line: 1, column: 14},
end: {line: 1, column: 20}
}
+ },
+ {
+ type: "RestElement",
+ argument: {
+ type: "Identifier",
+ name: "f",
+ loc: {
+ start: {line: 1, column: 25},
+ end: {line: 1, column: 26}
+ }
+ }
}
],
- defaults: [],
body: {
type: "BlockStatement",
body: [],
@@ -12871,14 +12767,6 @@ test("({ a: b, c }, [d, e], ...f) => {}", {
end: {line: 1, column: 33}
}
},
- rest: {
- type: "Identifier",
- name: "f",
- loc: {
- start: {line: 1, column: 25},
- end: {line: 1, column: 26}
- }
- },
generator: false,
expression: false,
loc: {
@@ -13981,7 +13869,6 @@ test("e => yield* 10", {
end: {line: 1, column: 1}
}
}],
- defaults: [],
body: {
type: "BinaryExpression",
operator: "*",
@@ -14007,7 +13894,6 @@ test("e => yield* 10", {
end: {line: 1, column: 14}
}
},
- rest: null,
generator: false,
expression: true,
loc: {
@@ -14041,7 +13927,6 @@ test("(function () { yield* 10 })", {
type: "FunctionExpression",
id: null,
params: [],
- defaults: [],
body: {
type: "BlockStatement",
body: [{
@@ -14081,7 +13966,6 @@ test("(function () { yield* 10 })", {
end: {line: 1, column: 26}
}
},
- rest: null,
generator: false,
expression: false,
loc: {
@@ -14317,19 +14201,18 @@ test('function normal(x, y = 10) {}', {
name: "x"
},
{
- type: "Identifier",
- name: "y"
- }
- ],
- defaults: [
- null,
- {
- type: "Literal",
- value: 10,
- raw: "10"
+ type: "AssignmentPattern",
+ left: {
+ type: "Identifier",
+ name: "y"
+ },
+ right: {
+ type: "Literal",
+ value: 10,
+ raw: "10"
+ }
}
],
- rest: null,
generator: false,
body: {
type: "BlockStatement",
@@ -14714,8 +14597,6 @@ test("class A { static() {} }", {
range: [16, 21],
id: null,
params: [],
- defaults: [],
- rest: null,
generator: false,
body: {
type: "BlockStatement",
@@ -14764,8 +14645,6 @@ test("class A { *static() {} }", {
range: [17, 22],
id: null,
params: [],
- defaults: [],
- rest: null,
generator: true,
body: {
type: "BlockStatement",
diff --git a/test/tests.js b/test/tests.js
index d3beafc..dfbfda0 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -23788,21 +23788,23 @@ test("function hello(...rest) { }", {
}
}
},
- params: [],
- rest: {
- type: "Identifier",
- name: "rest",
- loc: {
- start: {
- line: 1,
- column: 18
- },
- end: {
- line: 1,
- column: 22
+ params: [{
+ type: "RestElement",
+ argument: {
+ type: "Identifier",
+ name: "rest",
+ loc: {
+ start: {
+ line: 1,
+ column: 18
+ },
+ end: {
+ line: 1,
+ column: 22
+ }
}
}
- },
+ }],
body: {
type: "BlockStatement",
body: [],
@@ -23877,22 +23879,25 @@ test("function hello(a, ...rest) { }", {
column: 16
}
}
- }
- ],
- rest: {
- type: "Identifier",
- name: "rest",
- loc: {
- start: {
- line: 1,
- column: 21
- },
- end: {
- line: 1,
- column: 25
+ },
+ {
+ type: "RestElement",
+ argument: {
+ type: "Identifier",
+ name: "rest",
+ loc: {
+ start: {
+ line: 1,
+ column: 21
+ },
+ end: {
+ line: 1,
+ column: 25
+ }
+ }
}
}
- },
+ ],
body: {
type: "BlockStatement",
body: [],
@@ -24089,21 +24094,23 @@ test("var hi = function (...r) { sayHi() };", {
init: {
type: "FunctionExpression",
id: null,
- params: [],
- rest: {
- type: "Identifier",
- name: "r",
- loc: {
- start: {
- line: 1,
- column: 22
- },
- end: {
- line: 1,
- column: 23
+ params: [{
+ type: "RestElement",
+ argument: {
+ type: "Identifier",
+ name: "r",
+ loc: {
+ start: {
+ line: 1,
+ column: 22
+ },
+ end: {
+ line: 1,
+ column: 23
+ }
}
}
- },
+ }],
body: {
type: "BlockStatement",
body: [
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git
More information about the Pkg-javascript-commits
mailing list