Skip to content

fix: handle default parameters scope leaks#17788

Merged
Rich-Harris merged 1 commit intosveltejs:mainfrom
mrkishi:default-parameter-scoping
Feb 25, 2026
Merged

fix: handle default parameters scope leaks#17788
Rich-Harris merged 1 commit intosveltejs:mainfrom
mrkishi:default-parameter-scoping

Conversation

@mrkishi
Copy link
Member

@mrkishi mrkishi commented Feb 24, 2026

Use separate scopes for function declarations/expressions and function bodies. This prevents variable declarations from leaking into default parameter initialization expressions.

Closes #17785.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Use separate scopes for function declarations/expressions and function
bodies. This prevents variable declarations from leaking into default
parameter initialization expressions.

Closes sveltejs#17785.
@changeset-bot
Copy link

changeset-bot bot commented Feb 24, 2026

🦋 Changeset detected

Latest commit: b6e386e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

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

@Rich-Harris Rich-Harris merged commit 3a28979 into sveltejs:main Feb 25, 2026
16 checks passed
@github-actions github-actions bot mentioned this pull request Feb 25, 2026
elliott-with-the-longest-name-on-github pushed a commit that referenced this pull request Feb 25, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## svelte@5.53.4

### Patch Changes

- fix: set server context after async transformError
([#17799](#17799))

- fix: hydrate if blocks correctly
([#17784](#17784))

- fix: handle default parameters scope leaks
([#17788](#17788))

- fix: prevent flushed effects from running again
([#17787](#17787))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scopes aren't tracked correctly in function arguments

2 participants