Files
reverse-engineering-anything/src/domain/appendAll.ts
T
gensokyo-devandgensokyo-dev 3ae23bfeff fix: append target-sized arrays without call spreads
`target.push(...items)` passes every item as a call argument and
overflows the stack once a target-sized array grows past the engine's
argument limit. This class was fixed one site at a time in #10304,
#10343, #10362 and #8632. Add one shared appendAll helper in
src/domain and use it at the remaining sites whose arrays grow with the
input: XML member counting, app-task row suggestions, native call
routes and unresolved calls, call-path caveats, environment-manifest
merges, reference-source import entries, dyld trace edges and JS
symbolic flow values. The web bundle merge from the previous commit now
uses the shared helper too.

Bounded spreads (fixed literals, page-sized reads) are left as they are.

Refs #10445
Refs #10342

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-14 14:59:41 +01:00

10 lines
366 B
TypeScript

/**
* Append every item in order. `target.push(...items)` passes each item as a
* call argument, which overflows the stack once a target-sized array grows
* past the engine's argument limit; this loop has no such limit.
*/
export const appendAll = <T>(target: T[], items: Iterable<T>): T[] => {
for (const item of items) target.push(item);
return target;
};