Skip to content

Commit 9a688cc

Browse files
fix: kill foreach
1 parent 330a3c0 commit 9a688cc

File tree

1 file changed

+6
-4
lines changed
  • packages/svelte/src/compiler/phases/3-transform/client/visitors

1 file changed

+6
-4
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,7 @@ export const template_visitors = {
17751775

17761776
/** @type {import('estree').Expression[]} */
17771777
const args = [context.state.node];
1778-
node.arguments.forEach((arg) => {
1778+
for (const arg of node.arguments) {
17791779
if (arg.type === 'SpreadElement') {
17801780
// this is a spread operation, meaning we need to thunkify all of its members, which we can't
17811781
// do until runtime
@@ -1787,7 +1787,7 @@ export const template_visitors = {
17871787
return;
17881788
}
17891789
args.push(b.thunk(/** @type {import('estree').Expression} */ (context.visit(arg))));
1790-
});
1790+
}
17911791

17921792
let snippet_function = /** @type {import('estree').Expression} */ (
17931793
context.visit(node.expression)
@@ -2483,7 +2483,9 @@ export const template_visitors = {
24832483
/** @type {import('estree').Statement[]} */
24842484
const declarations = [];
24852485

2486-
node.context.elements.forEach((argument, i) => {
2486+
for (let i = 0; i < node.context.elements.length; i++) {
2487+
const argument = node.context.elements[i];
2488+
24872489
if (!argument) return;
24882490

24892491
if (argument.type === 'Identifier') {
@@ -2547,7 +2549,7 @@ export const template_visitors = {
25472549

25482550
binding.expression = b.call(name);
25492551
}
2550-
});
2552+
}
25512553

25522554
body = b.block([
25532555
...declarations,

0 commit comments

Comments
 (0)