Fix NPE on pattern check

pull/2658/head
Michael Braun 5 years ago
parent c477f50b9a
commit f69f46c461

@ -16,7 +16,7 @@ function unpack_destructuring(contexts: Array<{ name: string, tail: string }>, n
}); });
} else if (node.type === 'ArrayPattern') { } else if (node.type === 'ArrayPattern') {
node.elements.forEach((element, i) => { node.elements.forEach((element, i) => {
if (element.type === 'RestIdentifier') { if (element && element.type === 'RestIdentifier') {
unpack_destructuring(contexts, element, `${tail}.slice(${i})`) unpack_destructuring(contexts, element, `${tail}.slice(${i})`)
} else { } else {
unpack_destructuring(contexts, element, `${tail}[${i}]`); unpack_destructuring(contexts, element, `${tail}[${i}]`);

Loading…
Cancel
Save