Skip to content

Commit 63e60c7

Browse files
committed
tweak
1 parent 2b42182 commit 63e60c7

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,11 @@ function build_assignment(operator, left, right, context) {
6868
in_constructor: rune !== '$derived' && rune !== '$derived.by'
6969
};
7070

71-
const field = context.state.state_fields[name];
72-
73-
const l = b.member(b.this, field.key);
74-
75-
const r = /** @type {Expression} */ (context.visit(right, child_state));
76-
77-
return b.assignment(operator, l, r);
71+
return b.assignment(
72+
operator,
73+
b.member(b.this, context.state.state_fields[name].key),
74+
/** @type {Expression} */ (context.visit(right, child_state))
75+
);
7876
}
7977
}
8078

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,16 @@ function build_assignment(operator, left, right, context) {
3535
const rune = get_rune(right, context.state.scope);
3636

3737
if (rune) {
38-
const field = context.state.state_fields[name];
39-
4038
const key =
4139
left.property.type === 'PrivateIdentifier' || rune === '$state' || rune === '$state.raw'
4240
? left.property
43-
: field.key;
44-
45-
const l = b.member(b.this, key, key.type === 'Literal');
46-
47-
const r = /** @type {Expression} */ (context.visit(right));
41+
: context.state.state_fields[name].key;
4842

49-
return b.assignment(operator, l, r);
43+
return b.assignment(
44+
operator,
45+
b.member(b.this, key, key.type === 'Literal'),
46+
/** @type {Expression} */ (context.visit(right))
47+
);
5048
}
5149
}
5250
}

0 commit comments

Comments
 (0)