Skip to content

Commit 7bbb640

Browse files
committed
dry out
1 parent 7d6b603 commit 7bbb640

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ export function RenderTag(node, context) {
7676
'$.async',
7777
context.state.node,
7878
memoizer.async_values(),
79-
b.arrow(
80-
[context.state.node, ...memoizer.async.map((memo) => memo.id)],
81-
b.block(statements)
82-
)
79+
b.arrow([context.state.node, ...memoizer.async_ids()], b.block(statements))
8380
)
8481
)
8582
);

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ export function SlotElement(node, context) {
8585
'$.async',
8686
context.state.node,
8787
async_values,
88-
b.arrow(
89-
[context.state.node, ...memoizer.async.map((memo) => memo.id)],
90-
b.block(statements)
91-
)
88+
b.arrow([context.state.node, ...memoizer.async_ids()], b.block(statements))
9289
)
9390
)
9491
);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ export function build_component(node, component_name, context) {
509509
'$.async',
510510
anchor,
511511
async_values,
512-
b.arrow([b.id('$$anchor'), ...memoizer.async.map(({ id }) => id)], b.block(statements))
512+
b.arrow([b.id('$$anchor'), ...memoizer.async_ids()], b.block(statements))
513513
)
514514
);
515515
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export class Memoizer {
3939
return all;
4040
}
4141

42+
async_ids() {
43+
return this.async.map((memo) => memo.id);
44+
}
45+
4246
async_values() {
4347
if (this.async.length === 0) return;
4448
return b.array(this.async.map((memo) => b.thunk(memo.expression, true)));

0 commit comments

Comments
 (0)