observablehq / parser

The Observable parser.
ISC License
176 stars 27 forks source link

Fix const detection with destructured rest elements #196

Closed mbostock closed 3 years ago

mbostock commented 3 years ago

A rest element would crash the parser rather than throwing a SyntaxError as expected:

({...md} = {})
([...md] = {})

In addition, sparse array destructuring would also crash the parser:

([,, ...md] = {})

This fixes the parser and adds tests.