diff --git a/packages/svelte/src/compiler/phases/3-transform/client/utils.js b/packages/svelte/src/compiler/phases/3-transform/client/utils.js index 9d70f0db54..0075e5b394 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/utils.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/utils.js @@ -259,15 +259,15 @@ export function serialize_set_binding(node, context, fallback) { node.type === 'ArrowFunctionExpression' ) ); - const closest_function_boundary_not_async = - closest_function_boundary === undefined || closest_function_boundary.async !== true; + const closest_function_boundary_is_async = + closest_function_boundary !== undefined && closest_function_boundary.async === true; const rhs_expression = /** @type {import('estree').Expression} */ (visit(node.right)); const iife_is_async = - !closest_function_boundary_not_async || - is_expression_async(rhs_expression) || - assignments.some((assignment) => is_expression_async(assignment)); + closest_function_boundary_is_async && + (is_expression_async(rhs_expression) || + assignments.some((assignment) => is_expression_async(assignment))); const iife = b.arrow( [],