Files
scriptc/packages/runtime
Malte UblandClaude Opus 5.5 dfacb791a1 Call typed replace callbacks without a dyn box
s.replace(re, fn) and replaceAll boxed a typed callback into a dyn
function and called it through the dyn ABI: per match, a dyn argument
array, a dyn node per capture and for the offset, the box's argument
checks back to typed values, and a dyn result converted to a string.

When every parameter the callback declares receives a value of its
declared kind in each match, the box is unobservable (the runtime only
calls it, with `this` undefined), so the backend passes the closure to
scr_regex_replace_fn, which collects the matches as before and calls the
closure through its own ABI. That holds for callbacks returning a string
that take the match string alone, or, with a regex literal whose captures
the compiled-matcher parser reads, captures every match sets (strings),
then the offset (a number) and the subject (a string). Callbacks with
optional, union or rest parameters, `arguments`, or captures some match
leaves unset keep the dyn path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 09:15:22 -07:00
..
2026-10-18 03:37:40 -05:00
2026-07-22 18:08:04 -05:00
2026-10-17 13:47:41 -05:00