fix: properly transform $props.id
when $props
is assigned to props
#2694
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a bit of weird one and I'm not sure there's a better way to handle this. The problem is that when you are doing this
the second
$props
identifier was not considered a rune because it's not an immediate function call. There's a catch tho: even if we check that the parent is a call expression and the text is$props.id
we can't rule that out immediately because it depends if theprops
variable comes from the assignment of$props()
or not. But the scope we have here is far less powerful than the one in the svelte compiler. So i had to do this weird dance where i still add the possible store in the array but i also save the fact that comes from$props.id
...then while walking if i encounter an identifierprops
which is in a variable declaration i check if the variable declaration initializer is$props()
.It should cover all the edge cases but it's a bit convoluted. Also i would've loved to add some comments here and there but everytime i open that file my vscode crashes 😳