escodegen
escodegen copied to clipboard
Destructuring issue
const {a=1, b=2} = {a:2};
To esprima (link) returns the correct AST.
Back to JS through escodegen:
const {a, b} = { a: 2 };
Which leaves b undefined.
Seems like a bug?
Ooops I didn't mean to close this. Seems to still be an issue.
Another possibly-related issue is related to template literals.
Code like this:
function returnHTML() {
return `
<h1>Hello</h1>
`;
}
convereted to AST by esprima and back to JavaScript by escodegen, turns into:
function returnHTML() {
return;
`
<h1>Hello</h1>
`;
}
... which I don't think is right.