Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Missing parentheses at FunctionExpression inside CallExpression inside SequenceExpression #977

Closed
leumasme opened this issue Aug 3, 2021 · 2 comments

Comments

@leumasme
Copy link

leumasme commented Aug 3, 2021

The following Code will generate a Function Expression inside of a Call Expression inside of a Sequence Expression.
(function(){})(), stuff()
When parsed and prettyPrinted through recast, it will print out the following, syntax-invalid, code:
function() {}(), stuff();

@eventualbuddha
Copy link
Collaborator

Yep, reproduced this as follows:

const recast = require('recast')
const ast = recast.parse('(function(){})(), stuff()')
recast.parse(recast.prettyPrint(ast).code) // throws 'Unexpected token ('

@gnprice
Copy link
Contributor

gnprice commented Jun 12, 2022

This issue no longer reproduces 🎉.

It was fixed by #1057: the issue still reproduces at the commit before that, and no longer does at that commit.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants