Fix crash when exporting with destructuring and sparse array (#170)
* Create reproducible crash when exporting with destructuring and sparse array * Fix crash when exporting with destructuring and sparse array
This commit is contained in:
parent
b1fc65530d
commit
e14f93d1bb
@ -943,7 +943,9 @@ pp.checkDeclaration = function(node) {
|
||||
}
|
||||
} else if (node.type === "ArrayPattern") {
|
||||
for (let elem of node.elements) {
|
||||
this.checkDeclaration(elem);
|
||||
if (elem) {
|
||||
this.checkDeclaration(elem);
|
||||
}
|
||||
}
|
||||
} else if (node.type === "ObjectProperty") {
|
||||
this.checkDeclaration(node.value);
|
||||
|
||||
@ -9,3 +9,4 @@ export const [{ foo: [baz3] }, { foo2: [baz4] }] = bar;
|
||||
export const { foo: { baz: { qux3 } }, foo2: { baz2: [qux4]} } = bar;
|
||||
export const { foo: { baz: { qux5 } }, foo2: { baz2: [{qux6}]} } = bar;
|
||||
export const { Foo } = bar;
|
||||
export const { foo: [ ,, qux7 ] } = bar;
|
||||
|
||||
@ -1,29 +1,29 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 481,
|
||||
"end": 522,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 11,
|
||||
"column": 27
|
||||
"line": 12,
|
||||
"column": 40
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 481,
|
||||
"end": 522,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 11,
|
||||
"column": 27
|
||||
"line": 12,
|
||||
"column": 40
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
@ -2431,6 +2431,158 @@
|
||||
],
|
||||
"kind": "const"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExportNamedDeclaration",
|
||||
"start": 482,
|
||||
"end": 522,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 40
|
||||
}
|
||||
},
|
||||
"specifiers": [],
|
||||
"source": null,
|
||||
"declaration": {
|
||||
"type": "VariableDeclaration",
|
||||
"start": 489,
|
||||
"end": 522,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 40
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 495,
|
||||
"end": 521,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 39
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "ObjectPattern",
|
||||
"start": 495,
|
||||
"end": 515,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 33
|
||||
}
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start": 497,
|
||||
"end": 513,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 31
|
||||
}
|
||||
},
|
||||
"method": false,
|
||||
"shorthand": false,
|
||||
"computed": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 497,
|
||||
"end": 500,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"value": {
|
||||
"type": "ArrayPattern",
|
||||
"start": 502,
|
||||
"end": 513,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 31
|
||||
}
|
||||
},
|
||||
"elements": [
|
||||
null,
|
||||
null,
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 507,
|
||||
"end": 511,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 25
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 29
|
||||
}
|
||||
},
|
||||
"name": "qux7"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"init": {
|
||||
"type": "Identifier",
|
||||
"start": 518,
|
||||
"end": 521,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 36
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 39
|
||||
}
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user