-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: simplify assignments in server code #12614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: df19c83 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Just found a bug in the existing code — we don't respect the operator when reassigning store values: // in
$count += 1;
$count += 1;
$count += 1; // out
$.store_set(count, 1);
$.store_set(count, 1);
$.store_set(count, 1); Will fix in this PR. |
Another existing bug: we don't handle |
packages/svelte/src/compiler/phases/3-transform/server/visitors/AssignmentExpression.js
Show resolved
Hide resolved
…s/AssignmentExpression.js
Another thing I found during the recent refactor — the server version of
serialize_set_binding
contains some useless code. This tidies it up, colocates it withAssignmentExpression
(the only visitor that uses it), and as a bonus improves the code generation along the lines suggested by #11921. Given this input......we generate this:
It'd be good to do the same for client-side code, and we can probably reuse some code. I didn't want to get carried away though.
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint