diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/EachBlock.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/EachBlock.js index f80fa0e61e..f3c8be8cbb 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/EachBlock.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/EachBlock.js @@ -239,7 +239,7 @@ export function EachBlock(node, context) { const needs_derived = path.has_default_value; // to ensure that default value is only called once const fn = b.thunk( - /** @type {Expression} */ (context.visit(path.expression?.(unwrapped), child_state)) + /** @type {Expression} */ (context.visit(path.expression(unwrapped), child_state)) ); declarations.push(b.let(path.node, needs_derived ? b.call('$.derived_safe_equal', fn) : fn)); diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/SnippetBlock.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/SnippetBlock.js index a82645cd7a..4dd69c81f7 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/SnippetBlock.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/SnippetBlock.js @@ -49,7 +49,7 @@ export function SnippetBlock(node, context) { const name = /** @type {Identifier} */ (path.node).name; const needs_derived = path.has_default_value; // to ensure that default value is only called once const fn = b.thunk( - /** @type {Expression} */ (context.visit(path.expression?.(b.maybe_call(b.id(arg_alias))))) + /** @type {Expression} */ (context.visit(path.expression(b.maybe_call(b.id(arg_alias))))) ); declarations.push(b.let(path.node, needs_derived ? b.call('$.derived_safe_equal', fn) : fn)); diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js index db153020fb..f2830528d0 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js @@ -146,7 +146,7 @@ export function VariableDeclaration(node, context) { declarations.push( b.declarator(tmp, value), ...paths.map((path) => { - const value = path.expression?.(tmp); + const value = path.expression(tmp); const binding = context.state.scope.get(/** @type {Identifier} */ (path.node).name); return b.declarator( path.node, @@ -237,7 +237,7 @@ export function VariableDeclaration(node, context) { for (const path of paths) { const name = /** @type {Identifier} */ (path.node).name; const binding = /** @type {Binding} */ (context.state.scope.get(name)); - const value = path.expression?.(b.id(tmp)); + const value = path.expression(b.id(tmp)); declarations.push( b.declarator( path.node, @@ -309,7 +309,7 @@ function create_state_declarators(declarator, { scope, analysis }, value) { return [ b.declarator(b.id(tmp), value), ...paths.map((path) => { - const value = path.expression?.(b.id(tmp)); + const value = path.expression(b.id(tmp)); const binding = scope.get(/** @type {Identifier} */ (path.node).name); return b.declarator( path.node, diff --git a/packages/svelte/src/compiler/phases/3-transform/server/visitors/VariableDeclaration.js b/packages/svelte/src/compiler/phases/3-transform/server/visitors/VariableDeclaration.js index b76455b5c1..8110576d13 100644 --- a/packages/svelte/src/compiler/phases/3-transform/server/visitors/VariableDeclaration.js +++ b/packages/svelte/src/compiler/phases/3-transform/server/visitors/VariableDeclaration.js @@ -129,7 +129,7 @@ export function VariableDeclaration(node, context) { ) ); for (const path of paths) { - const value = path.expression?.(b.id(tmp)); + const value = path.expression(b.id(tmp)); const name = /** @type {Identifier} */ (path.node).name; const binding = /** @type {Binding} */ (context.state.scope.get(name)); const prop = b.member(b.id('$$props'), b.literal(binding.prop_alias ?? name), true); @@ -188,12 +188,12 @@ function create_state_declarators(declarator, scope, value) { return [b.declarator(declarator.id, value)]; } - const tmp = scope.generate('tmp'); + const tmp = b.id(scope.generate('tmp')); const paths = extract_paths(declarator.id); return [ - b.declarator(b.id(tmp), value), // TODO inject declarator for opts, so we can use it below + b.declarator(tmp, value), // TODO inject declarator for opts, so we can use it below ...paths.map((path) => { - const value = path.expression?.(b.id(tmp)); + const value = path.expression(tmp); return b.declarator(path.node, value); }) ];