Open lucivpav opened 3 years ago
the more problematic scenario is when having an arrow function returning an object expression in this scenario the generated code is actually invalid
() => (
// comment
{
a: 1, b: 2
})
output:
() => // comment
{
a: 1,
b: 2
});
suggested output:
() => ( // comment
{
a: 1,
b: 2
)});
@Meir017 looks like this belongs to the related issue #365. Nice catch!
@lucivpav we also need to support this syntax:
var a = b => ({}.hasOwnProperty.call(b, "c"));
which actually translates to a CallExpression
Problem with
escodegen.attachComments
(and maybe also withesprima.parse
). See https://github.com/estools/escodegen/blob/master/test/comment.js or #427 PR for reproduction.Input:
Output:
Suggested output: