chore: fix more wacky compiler output (#16794)

* chore: fix more wacky compiler output

* update tests
main
Rich Harris 1 day ago committed by GitHub
parent 4616422832
commit dc7da40369
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -198,11 +198,11 @@ export function server_component(analysis, options) {
b.unary('!', b.id('$$settled')),
b.block([
b.stmt(b.assignment('=', b.id('$$settled'), b.true)),
b.stmt(b.assignment('=', b.id('$$inner_renderer'), b.call(' $$renderer.copy'))),
b.stmt(b.assignment('=', b.id('$$inner_renderer'), b.call('$$renderer.copy'))),
b.stmt(b.call('$$render_inner', b.id('$$inner_renderer')))
])
),
b.stmt(b.call(' $$renderer.subsume', b.id('$$inner_renderer')))
b.stmt(b.call('$$renderer.subsume', b.id('$$inner_renderer')))
];
}
@ -301,7 +301,7 @@ export function server_component(analysis, options) {
const code = b.literal(render_stylesheet(analysis.source, analysis, options).code);
body.push(b.const('$$css', b.object([b.init('hash', hash), b.init('code', code)])));
component_block.body.unshift(b.stmt(b.call(' $$renderer.global.css.add', b.id('$$css'))));
component_block.body.unshift(b.stmt(b.call('$$renderer.global.css.add', b.id('$$css'))));
}
let should_inject_props =

@ -45,11 +45,11 @@ export function EachBlock(node, context) {
);
if (node.fallback) {
const open = b.stmt(b.call(b.id(' $$renderer.push'), block_open));
const open = b.stmt(b.call(b.id('$$renderer.push'), block_open));
const fallback = /** @type {BlockStatement} */ (context.visit(node.fallback));
fallback.body.unshift(b.stmt(b.call(b.id(' $$renderer.push'), block_open_else)));
fallback.body.unshift(b.stmt(b.call(b.id('$$renderer.push'), block_open_else)));
block.body.push(
b.if(

@ -16,9 +16,9 @@ export function IfBlock(node, context) {
? /** @type {BlockStatement} */ (context.visit(node.alternate))
: b.block([]);
consequent.body.unshift(b.stmt(b.call(b.id(' $$renderer.push'), block_open)));
consequent.body.unshift(b.stmt(b.call(b.id('$$renderer.push'), block_open)));
alternate.body.unshift(b.stmt(b.call(b.id(' $$renderer.push'), block_open_else)));
alternate.body.unshift(b.stmt(b.call(b.id('$$renderer.push'), block_open_else)));
/** @type {Statement} */
let statement = b.if(test, consequent, alternate);

@ -97,7 +97,7 @@ export function RegularElement(node, context) {
b.stmt(
b.assignment(
'=',
b.id(' $$renderer.local.select_value'),
b.id('$$renderer.local.select_value'),
b.member(
build_spread_object(
node,
@ -125,7 +125,7 @@ export function RegularElement(node, context) {
);
}
const left = b.id(' $$renderer.local.select_value');
const left = b.id('$$renderer.local.select_value');
if (value.type === 'Attribute') {
state.template.push(
b.stmt(b.assignment('=', left, build_attribute_value(value.value, context)))

@ -80,7 +80,7 @@ export function process_children(nodes, { visit, state }) {
flush();
const visited = /** @type {Expression} */ (visit(node.expression));
state.template.push(
b.stmt(b.call(' $$renderer.push', b.thunk(b.call('$.escape', visited), true)))
b.stmt(b.call('$$renderer.push', b.thunk(b.call('$.escape', visited), true)))
);
} else if (node.type === 'Text' || node.type === 'Comment' || node.type === 'ExpressionTag') {
sequence.push(node);
@ -119,7 +119,7 @@ export function build_template(template) {
statements.push(
b.stmt(
b.call(
b.id(' $$renderer.push'),
b.id('$$renderer.push'),
b.template(
strings.map((cooked, i) => b.quasi(cooked, i === strings.length - 1)),
expressions
@ -267,7 +267,7 @@ export function build_getter(node, state) {
* @returns {Statement}
*/
export function call_child_renderer(body, async) {
return b.stmt(b.call(' $$renderer.child', b.arrow([b.id('$$renderer')], body, async)));
return b.stmt(b.call('$$renderer.child', b.arrow([b.id('$$renderer')], body, async)));
}
/**
@ -277,7 +277,7 @@ export function call_child_renderer(body, async) {
*/
export function call_component_renderer(body, component_fn_id) {
return b.stmt(
b.call(' $$renderer.component', b.arrow([b.id('$$renderer')], body, false), component_fn_id)
b.call('$$renderer.component', b.arrow([b.id('$$renderer')], body, false), component_fn_id)
);
}

Loading…
Cancel
Save