escodegen
escodegen copied to clipboard
Add support Class field declarations
This is required because Acorn uses acorn-class-fields.
What is wrong with CL
Looking at the build logs versus https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#browser_compatibility, the bug is obvious. Classes field support started in Node 12, but the .travis.yml file mandates testing against Node 6, 8, and 10.
Looking at the build logs versus https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#browser_compatibility, the bug is obvious. Classes field support started in Node 12, but the .travis.yml file mandates testing against Node 6, 8, and 10.
No, the Node version is irrelevant here. The parser used is acorn, and the issue is that test/compare-acorn-es2019/
directory is being processed without the acorn-class-fields
plugin. Here:
https://github.com/estools/escodegen/blob/7a48a218cff99cd38e38e54ac8f310196314702e/test/compare-acorn-es2019.js#L39-L45
And here:
https://github.com/estools/escodegen/blob/7a48a218cff99cd38e38e54ac8f310196314702e/test/compare-acorn-es2019.js#L58-L64
I added a PR that supersedes this with more tests that pass: https://github.com/estools/escodegen/pull/465