swc/crates/swc_estree_compat/src
Justin Ridgewell a203fdb1b6
fix(common): Fix BytePos -> CharPos calculations (#6574)
**Description:**

This fixes the BytePos -> CharPos calculation necessary for source maps.
There were a few issues in the old code:

1. UTF-8 maps 1-3 bytes into 1 UTF-16 char, but 4 bytes into 2 UTF-16 chars
2. The starting offset was not recorded when we reached the end of the `multibyte_chars` iteration
3. The `mappings` can be unordered, meaning we need to restart the UTF-16 offset calculation

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6552.
2022-12-04 14:52:00 +09:00
..
babelify fix(common): Fix BytePos -> CharPos calculations (#6574) 2022-12-04 14:52:00 +09:00
swcify perf(es): Optimize memory layout of AST (#5829) 2022-09-20 12:47:21 +09:00
lib.rs refactor(es): More fix for clippy (#3280) 2022-01-16 14:33:06 +09:00