-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
When I use array destructuring with ignored values, grasp throws error.
(see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Ignoring_some_returned_values)
echo 'var [a, , b] = f()' | grasp "*"
Cannot read property 'type' of null
I have checked also flow parser. It has no problems with parsing this code. The 'ignored value' is represented by NULL in elements array:
{
"type": "ArrayPattern",
"loc": {
"source": null,
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 12
}
},
"range": [
4,
12
],
"elements": [
{
"type": "Identifier",
"loc": {
"source": null,
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 6
}
},
"range": [
5,
6
],
"name": "a",
"typeAnnotation": null,
"optional": false
},
null,
{
"type": "Identifier",
"loc": {
"source": null,
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
}
},
"range": [
10,
11
],
"name": "b",
"typeAnnotation": null,
"optional": false
}
],
"typeAnnotation": null
},
ainthek
Metadata
Metadata
Assignees
Labels
No labels