Files
scriptc/tests
Chris Tate 2840a92124 Keep while-loop counters bounded by a string's length in int32
A while loop that advances a counter through a string, such as

    while (pos < text.length) {
      const ch = text.charCodeAt(pos);
      pos++;
      if (ch === 13 && pos < text.length && text.charCodeAt(pos) === 10) pos++;
      ...
    }

kept the counter as a double, so every read converted it and every
charCodeAt took the general index path. The guarded while-counter facts
accepted only a literal or a binding the loop never writes as the
bound. They now also accept the length of a string binding the loop
never writes, which is at most 2^31 - 1 units.

The counter's maximum is also tracked along each path of the body
instead of summing every increment: an increment inside an `if` whose
condition compares the counter below such a bound starts from that
bound, and exits end their path. The second increment above therefore
keeps the counter within int32, and the counter gets int32 storage and
integer charCodeAt reads.
2026-10-17 11:09:48 -05:00
..
2026-07-22 18:08:04 -05:00