mirror of
https://github.com/hanzoai/swc.git
synced 2026-10-30 19:42:53 +00:00
**Description:** The JSON parse optimization had a number fast path that cast through `i64`. That path could be unsafe for out-of-range values and for `-0`, changing observable results. This PR keeps the optimization but only uses the `i64` path when safe: when the number is an integer within `i64` range and does not alter the zero sign. Other finite numbers are serialized via `serde_json::Number::from_f64`, and non-finite handling is updated so `NaN` is rejected while `±Infinity` is emitted as `±2e308`. **Related issue (if exists):** - #12043 - #12047 - #12050 - #12048 - **#12051** (current) - #12052 - #12053 - #12054 - #12055 - #12056 - #12057 - #12058 - #12049 - #12059 - #12060