escodegen icon indicating copy to clipboard operation
escodegen copied to clipboard

Add support Class field declarations

Open DrawAChicken opened this issue 4 years ago • 4 comments

This is required because Acorn uses acorn-class-fields.

DrawAChicken avatar Dec 31 '20 07:12 DrawAChicken

What is wrong with CL

DrawAChicken avatar Jan 06 '21 07:01 DrawAChicken

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.

ajvincent avatar Apr 05 '21 18:04 ajvincent

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

palant avatar Dec 21 '21 10:12 palant

I added a PR that supersedes this with more tests that pass: https://github.com/estools/escodegen/pull/465

kevincox avatar Apr 07 '24 14:04 kevincox