You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Babel and Recast in conjunction to transform my AST. When I use Babel alone, the output is fine (although not formatted correctly.) When I introduce Recast, it drops parens, changing the program semantics (or introducing a syntax error).
We can see that the () around the arrow function return expression are dropped. When there are multiple members of the object, this results in a syntax error:
i.e., the Recast result has that necessary pair of parens, just like the Babel result.
The issue does still reproduce if I go back to Recast 0.21.0. So most likely it was fixed by #1068, which was a parenthesization fix that happened between those versions.
I'm using Babel and Recast in conjunction to transform my AST. When I use Babel alone, the output is fine (although not formatted correctly.) When I introduce Recast, it drops parens, changing the program semantics (or introducing a syntax error).
Input code:
Babel plugin:
Transformed results:
Full runnable repro.
We can see that the
()
around the arrow function return expression are dropped. When there are multiple members of the object, this results in a syntax error:Possibly related: #914, #327, #533, #81
Versions:
recast@0.20.5
@babel/core@7.15.5
The text was updated successfully, but these errors were encountered: