forked from sveltejs/svelte
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] introduce helper method to prevent push maximum call stack size…
… exceeded error Part of sveltejs#4694 Also related: Rich-Harris/code-red#71
- Loading branch information
Simon
committed
Jan 29, 2022
1 parent
d1b3f46
commit 7f4d0cd
Showing
7 changed files
with
27 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Pushes all `items` into `array` using `push`, therefore mutating the array. | ||
* We do this for memory and perf reasons, and because `array.push(...items)` would | ||
* run into a "max call stack size exceeded" error with too many items (~65k). | ||
* @param array | ||
* @param items | ||
*/ | ||
export function push_array<T>(array: T[], items: T[]): void { | ||
for (let i = 0; i < items.length; i++) { | ||
array.push(items[i]); | ||
} | ||
} |