escodegen
escodegen copied to clipboard
Support trees with immediate .start and .end (without .range)
Acorn and Meriyah are generating trees that have .start and .end properties without wrapping .range array. I added support for parsing such trees + tests to check our range usage
I'd like to see integration tests here, not just synthetic unit tests. If you're claiming Acorn creates trees of this form, prove it by showing a failing integration test that is fixed by your change.
@michaelficarra done. Frankly, Acorn is working even without the fix when using ranges: true
(like in the current integration test compare-acorn-es6
). But without this flag, the default behaviour doesn't. New libraries such as Meriyah or Cherow don't even have this feature - they add .start and .end to nodes like Acorn does by default. When ranges
is turned on in Acorn it just duplicates the same values into range
and keeps both. I feel like we should support both node types to not break compatibility.