davidbonnet / astring

🌳 Tiny and fast JavaScript code generator from an ESTree-compliant AST.
https://david.bonnet.cc/astring/demo/
MIT License
1.17k stars 57 forks source link

astring 1.8.5 generates invalid code when `??` is used #695

Closed znewsham closed 1 year ago

znewsham commented 1 year ago

Motivation

astring.generate(acorn.parse('const x = (a && a.b) ?? c'))

Expected behavior

In version 1.8.4 the output is

const x = (a && a.b) ?? c;

Actual behavior

In 1.8.5 the (invalid) output is

const x = a && a.b ?? c;
davidbonnet commented 1 year ago

Thanks for reporting this @znewsham.