Skip to content

Commit 40f8ff9

Browse files
committed
more
1 parent 7d8e172 commit 40f8ff9

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

packages/svelte/src/compiler/phases/3-transform/server/transform-server.js

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,10 +1460,6 @@ const template_visitors = {
14601460
init: []
14611461
};
14621462

1463-
const main = /** @type {import('estree').BlockStatement} */ (
1464-
context.visit(node.fragment, state)
1465-
);
1466-
14671463
serialize_element_attributes(node, { ...context, state });
14681464

14691465
if (context.state.options.dev) {
@@ -1472,24 +1468,17 @@ const template_visitors = {
14721468
);
14731469
}
14741470

1475-
context.state.template.push(
1476-
t_statement(
1477-
b.if(
1478-
tag,
1479-
b.stmt(
1480-
b.call(
1481-
'$.element',
1482-
b.id('$$payload'),
1483-
tag,
1484-
b.thunk(b.block([...state.init, ...serialize_template(state.template)])),
1485-
b.thunk(main)
1486-
)
1487-
)
1488-
)
1489-
),
1490-
block_anchor
1471+
const attributes = b.block([...state.init, ...serialize_template(state.template)]);
1472+
const children = /** @type {import('estree').BlockStatement} */ (
1473+
context.visit(node.fragment, state)
1474+
);
1475+
1476+
const body = b.stmt(
1477+
b.call('$.element', b.id('$$payload'), tag, b.thunk(attributes), b.thunk(children))
14911478
);
14921479

1480+
context.state.template.push(t_statement(b.if(tag, body)), block_anchor);
1481+
14931482
if (context.state.options.dev) {
14941483
context.state.template.push(t_statement(b.stmt(b.call('$.pop_element'))));
14951484
}

0 commit comments

Comments
 (0)