Skip to content

Commit 00549ff

Browse files
authored
perf: iterate children using a for loop (#694)
1 parent 73479f9 commit 00549ff

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/parser/converts/block.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,17 @@ export function convertIfBlock(
147147
});
148148
const consequent = getConsequentFromIfBlock(node);
149149

150-
ifBlock.children.push(
151-
...convertChildren(
152-
{
153-
nodes:
154-
// Adjust for Svelte v5
155-
trimChildren(getChildren(consequent)),
156-
},
157-
ifBlock,
158-
ctx,
159-
),
160-
);
150+
for (const child of convertChildren(
151+
{
152+
nodes:
153+
// Adjust for Svelte v5
154+
trimChildren(getChildren(consequent)),
155+
},
156+
ifBlock,
157+
ctx,
158+
)) {
159+
ifBlock.children.push(child);
160+
}
161161

162162
ctx.scriptLet.closeScope();
163163
if (elseif) {
@@ -218,17 +218,17 @@ export function convertIfBlock(
218218
ifBlock.else = elseBlock;
219219

220220
ctx.scriptLet.nestBlock(elseBlock);
221-
elseBlock.children.push(
222-
...convertChildren(
223-
{
224-
nodes:
225-
// Adjust for Svelte v5
226-
trimChildren(elseChildren),
227-
},
228-
elseBlock,
229-
ctx,
230-
),
231-
);
221+
for (const child of convertChildren(
222+
{
223+
nodes:
224+
// Adjust for Svelte v5
225+
trimChildren(elseChildren),
226+
},
227+
elseBlock,
228+
ctx,
229+
)) {
230+
elseBlock.children.push(child);
231+
}
232232
ctx.scriptLet.closeScope();
233233
extractMustacheBlockTokens(elseBlock, ctx, { startOnly: true });
234234

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy