Fix array destructuring elision parsing in TS arrow functions (#13641)
This commit is contained in:
parent
bdc75dce72
commit
f9dcc4e4bb
@ -257,7 +257,9 @@ export default class LValParser extends NodeUtils {
|
|||||||
return this.isAssignable(node.argument);
|
return this.isAssignable(node.argument);
|
||||||
|
|
||||||
case "ArrayExpression":
|
case "ArrayExpression":
|
||||||
return node.elements.every(element => this.isAssignable(element));
|
return node.elements.every(
|
||||||
|
element => element === null || this.isAssignable(element),
|
||||||
|
);
|
||||||
|
|
||||||
case "AssignmentExpression":
|
case "AssignmentExpression":
|
||||||
return node.operator === "=";
|
return node.operator === "=";
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
([, a]): b => c;
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||||
|
"expression": {
|
||||||
|
"type": "ArrowFunctionExpression",
|
||||||
|
"start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}},
|
||||||
|
"returnType": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeReference",
|
||||||
|
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}},
|
||||||
|
"typeName": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"b"},
|
||||||
|
"name": "b"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": null,
|
||||||
|
"generator": false,
|
||||||
|
"async": false,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "ArrayPattern",
|
||||||
|
"start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6}},
|
||||||
|
"elements": [
|
||||||
|
null,
|
||||||
|
{
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"},
|
||||||
|
"name": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"c"},
|
||||||
|
"name": "c"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user