From cd7d015e956f3368965bc25e236025eb2e6e40f0 Mon Sep 17 00:00:00 2001 From: Nguyen Tran Date: Wed, 3 Jan 2024 21:41:33 -0500 Subject: [PATCH] Fixed wrong flipped logic --- .../src/compiler/phases/3-transform/client/utils.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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( [],