sebastienros / esprima-dotnet

Esprima .NET (BSD license) is a .NET port of the esprima.org project. It is a standard-compliant ECMAScript parser (also popularly known as JavaScript).
BSD 3-Clause "New" or "Revised" License
430 stars 75 forks source link

Fix a few edge cases in AST to JS conversion #413

Closed adams85 closed 1 year ago

adams85 commented 1 year ago

Makes changes to AstToJsonConverter to correctly parenthesize logical expressions which mix nullish coalescing and logical AND/OR operations (e.g. a ?? b && c).

Also, fixes formatting of plus/minus binary operations having a right side that starts with an ambiguous punctuator (e.g. a+++b vs a+ ++b).

adams85 commented 1 year ago

Setting the status to draft as I discovered a few other problematic cases:

These are converted to JS incorrectly when formatting is turned off. That is, the PR needs some more work to tackle these as well.