pull/10939/head
Rich Harris 2 years ago
parent 8cfea9f36c
commit 7a152fa834

@ -1291,7 +1291,7 @@ function serialize_event(node, context) {
delegated_assignment = handler;
}
state.after_update.push(
state.init.push(
b.stmt(
b.assignment(
'=',
@ -1720,11 +1720,9 @@ export const template_visitors = {
}
if (is_reactive) {
context.state.after_update.push(
b.stmt(b.call('$.snippet', b.thunk(snippet_function), ...args))
);
context.state.init.push(b.stmt(b.call('$.snippet', b.thunk(snippet_function), ...args)));
} else {
context.state.after_update.push(
context.state.init.push(
b.stmt(
(node.expression.type === 'CallExpression' ? b.call : b.maybe_call)(
snippet_function,
@ -2091,7 +2089,7 @@ export const template_visitors = {
}
})
);
context.state.after_update.push(
context.state.init.push(
b.stmt(
b.call(
'$.element',
@ -2344,7 +2342,7 @@ export const template_visitors = {
);
}
context.state.after_update.push(
context.state.init.push(
b.stmt(
b.call(
'$.each_keyed',
@ -2358,7 +2356,7 @@ export const template_visitors = {
)
);
} else {
context.state.after_update.push(
context.state.init.push(
b.stmt(
b.call(
'$.each_indexed',
@ -2421,12 +2419,12 @@ export const template_visitors = {
args.push(b.literal(true));
}
context.state.after_update.push(b.stmt(b.call('$.if', ...args)));
context.state.init.push(b.stmt(b.call('$.if', ...args)));
},
AwaitBlock(node, context) {
context.state.template.push('<!>');
context.state.after_update.push(
context.state.init.push(
b.stmt(
b.call(
'$.await',
@ -2468,7 +2466,7 @@ export const template_visitors = {
context.state.template.push('<!>');
const key = /** @type {import('estree').Expression} */ (context.visit(node.expression));
const body = /** @type {import('estree').Expression} */ (context.visit(node.fragment));
context.state.after_update.push(
context.state.init.push(
b.stmt(b.call('$.key', context.state.node, b.thunk(key), b.arrow([b.id('$$anchor')], body)))
);
},
@ -2789,7 +2787,7 @@ export const template_visitors = {
if (binding !== null && binding.kind !== 'normal') {
// Handle dynamic references to what seems like static inline components
const component = serialize_inline_component(node, '$$component', context);
context.state.after_update.push(
context.state.init.push(
b.stmt(
b.call(
'$.component',
@ -2806,12 +2804,12 @@ export const template_visitors = {
return;
}
const component = serialize_inline_component(node, node.name, context);
context.state.after_update.push(component);
context.state.init.push(component);
},
SvelteSelf(node, context) {
context.state.template.push('<!>');
const component = serialize_inline_component(node, context.state.analysis.name, context);
context.state.after_update.push(component);
context.state.init.push(component);
},
SvelteComponent(node, context) {
context.state.template.push('<!>');
@ -2820,7 +2818,7 @@ export const template_visitors = {
if (context.state.options.dev) {
component = b.stmt(b.call('$.validate_dynamic_component', b.thunk(b.block([component]))));
}
context.state.after_update.push(
context.state.init.push(
b.stmt(
b.call(
'$.component',
@ -2972,7 +2970,7 @@ export const template_visitors = {
: b.member(b.member(b.id('$$props'), b.id('$$slots')), name, true, true);
const slot = b.call('$.slot', context.state.node, expression, props_expression, fallback);
context.state.after_update.push(b.stmt(slot));
context.state.init.push(b.stmt(slot));
},
SvelteHead(node, context) {
// TODO attributes?

@ -28,9 +28,9 @@ export default function State_proxy_literal($$anchor, $$props) {
var button = $.sibling($.sibling(input_1, true));
button.__click = [reset, str, tpl];
$.bind_value(input, () => $.get(str), ($$value) => $.set(str, $$value));
$.bind_value(input_1, () => $.get(tpl), ($$value) => $.set(tpl, $$value));
button.__click = [reset, str, tpl];
$.close_frag($$anchor, fragment);
$.pop();
}

Loading…
Cancel
Save