mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-06 08:23:19 +08:00
A counted for loop needs a stable limit to run its counter in integer storage. Array lengths qualified when the loop provably keeps them, but a string's length did not, so `for (let i = 0; i < s.length; i++)` kept a double counter and evaluated the length, through the UTF-16 mapping of a non-ASCII string, on every iteration. A string's length cannot change, so it is now stable whenever the string's binding is not rebound in the loop or boxed.