Open adiba opened 7 years ago
That is not a program.
I am confused. What is not a program? Is escodegen only intended for code rewrite and not AST modification? Do you want me to provide JSON? I still don't see why you closed this issue.
The AST you referenced does not represent a program. What program do you think it represents? If you add the curly braces you suggested in the linked issue, that is a different AST. We could possibly throw when passed non-programs, but it would make the common case slower, so :-1:.
Try using esvalid before passing the AST to escodegen so you know what you get from escodegen is meaningful.
Thank you for that hint.
I think mentioning in the readme that escodegen accepts any program without warning would be helpful.
@adiba I agree. Would you like to send a PR?
See https://github.com/benjamn/recast/issues/416 Same issue with
escodegen.generate(ast)