-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
chore: move stuff from analysis
into global compiler state
#16268
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
|
|
This is cool - let's just hope our compiler never needs to become async 😜 |
if it does, |
#16268 introduced a slight regression where the state is not reset completely upon compilation. It did reset warnings but not other state, which meant if file A succeeds but file B fails in the parsing state (before the state was reset for real) it would get wrong filename info. This fixes it by setting the filename at the very beginning.
#16268 introduced a slight regression where the state is not reset completely upon compilation. It did reset warnings but not other state, which meant if file A succeeds but file B fails in the parsing state (before the state was reset for real) it would get wrong filename info. This fixes it by setting the filename at the very beginning.
per #16255 (comment), this scratches an itch I've had for a while: we put a lot of stuff on
context.state.analysis
that doesn't really form part of the analysis phase, it's just a convenient place to stick it.It would be more convenient if that stuff was part of the global state exported from
state.js
— just as we guard dev-only compiler logic inif (dev)
rather thanif (context.state.analysis.dev)
we could also doif (runes)
, for example.While doing this I realised that we don't need to do
state.reset
insideparse(...)
, because we only actually need to resetsource
andlocator
. This meansparse
no longer needs to take an unusedfilename
option, so we can remove this in Svelte 6 and make that API simpler.This PR doesn't replace all the occurrences of
context.state.analysis.runes
(and.name
, etc) because that would likely create merge conflicts. That can be done as an easy follow-up when there's less stuff in the PR queue.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint