|
|
|
|
@ -194,11 +194,6 @@ export function VariableDeclaration(node, context) {
|
|
|
|
|
/** @type {CallExpression} */ (init)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// for now, only wrap async derived in $.save if it's not
|
|
|
|
|
// a top-level instance derived. TODO in future maybe we
|
|
|
|
|
// can dewaterfall all of them?
|
|
|
|
|
const should_save = context.state.is_instance && context.state.scope.function_depth > 1;
|
|
|
|
|
|
|
|
|
|
if (declarator.id.type === 'Identifier') {
|
|
|
|
|
let expression = /** @type {Expression} */ (context.visit(value));
|
|
|
|
|
|
|
|
|
|
@ -213,9 +208,7 @@ export function VariableDeclaration(node, context) {
|
|
|
|
|
location ? b.literal(location) : undefined
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
call = should_save ? save(call) : b.await(call);
|
|
|
|
|
|
|
|
|
|
declarations.push(b.declarator(declarator.id, call));
|
|
|
|
|
declarations.push(b.declarator(declarator.id, b.await(call)));
|
|
|
|
|
} else {
|
|
|
|
|
if (rune === '$derived') expression = b.thunk(expression);
|
|
|
|
|
|
|
|
|
|
@ -251,7 +244,7 @@ export function VariableDeclaration(node, context) {
|
|
|
|
|
location ? b.literal(location) : undefined
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
call = should_save ? save(call) : b.await(call);
|
|
|
|
|
call = b.await(call);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declarations.push(b.declarator(id, call));
|
|
|
|
|
|