Skip to content

Commit 4df7320

Browse files
committed
tweak
1 parent e91ff5b commit 4df7320

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/EachBlock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export function EachBlock(node, context) {
239239
const needs_derived = path.has_default_value; // to ensure that default value is only called once
240240

241241
const fn = b.thunk(
242-
/** @type {Expression} */ (context.visit(path.expression?.(unwrapped), child_state))
242+
/** @type {Expression} */ (context.visit(path.expression(unwrapped), child_state))
243243
);
244244

245245
declarations.push(b.let(path.node, needs_derived ? b.call('$.derived_safe_equal', fn) : fn));

packages/svelte/src/compiler/phases/3-transform/client/visitors/SnippetBlock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function SnippetBlock(node, context) {
4949
const name = /** @type {Identifier} */ (path.node).name;
5050
const needs_derived = path.has_default_value; // to ensure that default value is only called once
5151
const fn = b.thunk(
52-
/** @type {Expression} */ (context.visit(path.expression?.(b.maybe_call(b.id(arg_alias)))))
52+
/** @type {Expression} */ (context.visit(path.expression(b.maybe_call(b.id(arg_alias)))))
5353
);
5454

5555
declarations.push(b.let(path.node, needs_derived ? b.call('$.derived_safe_equal', fn) : fn));

packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export function VariableDeclaration(node, context) {
146146
declarations.push(
147147
b.declarator(tmp, value),
148148
...paths.map((path) => {
149-
const value = path.expression?.(tmp);
149+
const value = path.expression(tmp);
150150
const binding = context.state.scope.get(/** @type {Identifier} */ (path.node).name);
151151
return b.declarator(
152152
path.node,
@@ -237,7 +237,7 @@ export function VariableDeclaration(node, context) {
237237
for (const path of paths) {
238238
const name = /** @type {Identifier} */ (path.node).name;
239239
const binding = /** @type {Binding} */ (context.state.scope.get(name));
240-
const value = path.expression?.(b.id(tmp));
240+
const value = path.expression(b.id(tmp));
241241
declarations.push(
242242
b.declarator(
243243
path.node,
@@ -309,7 +309,7 @@ function create_state_declarators(declarator, { scope, analysis }, value) {
309309
return [
310310
b.declarator(b.id(tmp), value),
311311
...paths.map((path) => {
312-
const value = path.expression?.(b.id(tmp));
312+
const value = path.expression(b.id(tmp));
313313
const binding = scope.get(/** @type {Identifier} */ (path.node).name);
314314
return b.declarator(
315315
path.node,

packages/svelte/src/compiler/phases/3-transform/server/visitors/VariableDeclaration.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export function VariableDeclaration(node, context) {
129129
)
130130
);
131131
for (const path of paths) {
132-
const value = path.expression?.(b.id(tmp));
132+
const value = path.expression(b.id(tmp));
133133
const name = /** @type {Identifier} */ (path.node).name;
134134
const binding = /** @type {Binding} */ (context.state.scope.get(name));
135135
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) {
188188
return [b.declarator(declarator.id, value)];
189189
}
190190

191-
const tmp = scope.generate('tmp');
191+
const tmp = b.id(scope.generate('tmp'));
192192
const paths = extract_paths(declarator.id);
193193
return [
194-
b.declarator(b.id(tmp), value), // TODO inject declarator for opts, so we can use it below
194+
b.declarator(tmp, value), // TODO inject declarator for opts, so we can use it below
195195
...paths.map((path) => {
196-
const value = path.expression?.(b.id(tmp));
196+
const value = path.expression(tmp);
197197
return b.declarator(path.node, value);
198198
})
199199
];

0 commit comments

Comments
 (0)