escodegen icon indicating copy to clipboard operation
escodegen copied to clipboard

Support trees with immediate .start and .end (without .range)

Open GuyLewin opened this issue 5 years ago • 2 comments

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

GuyLewin avatar Oct 18 '19 23:10 GuyLewin

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 avatar Oct 19 '19 00:10 michaelficarra

@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.

GuyLewin avatar Oct 19 '19 12:10 GuyLewin