Comments (6)
I would add metadata.needs_private_getters to the class node and set that to true in the analysis phase when detecting a this expression that is not the first part of a member expression. Then in the code gen phase create those private getters/setters if that field is true
Great I'll try to give it a shot tomorrow if I have time.
from svelte.
Btw this is only true for private fields REPL.
This is because when a private field is accessed with this
the code get's converted by adding a .v
at the end which actually set the value of the signal. By doing it on an instance
you are tricking the compiler in not doing that.
while with public fields the set still goes through the setter which actually does a set
on the signal.
from svelte.
Basically here we should check if node.object.type is ThisExpression
but also if the name is any name to which this has been assigned to:
from svelte.
Is This the same as #11476 ? I think the easiest solution is to have a private getter/setter pair for each private state/derived backed by another private field. Bonus points for only doing that when we need to (i.e. when we detect this is assigned/passed to something)
from svelte.
Is This the same as #11476 ? I think the easiest solution is to have a private getter/setter pair for each private state/derived backed by another private field. Bonus points for only doing that when we need to (i.e. when we detect this is assigned/passed to something)
Yeah I think is the same. Since the problem is only there with private fields because public gets rewritten to private+get&set even if you return this you'll have no way to access them outside.
I like your idea...we should explore every method of the class to be sure this is not assigned to a class property right?
from svelte.
I would add metadata.needs_private_getters to the class node and set that to true in the analysis phase when detecting a this expression that is not the first part of a member expression. Then in the code gen phase create those private getters/setters if that field is true
from svelte.
Related Issues (20)
- $derived rune on Set object does not re-render on update HOT 2
- Svelte 5: Cannot specify `this`' type in TypeScript HOT 3
- Accessibility warning: href shouldn't be required when aria-disabled="true"
- Svelte 5: confusing behaviour with syntactically invalid attribute expressions HOT 2
- Add rune to more easily combine reactive values and state objects HOT 5
- Passing a Writable as prop to a component doesn't allow "$" access HOT 2
- Svelte 5: dynamic class name not supported on SVG
- Svelte 5: Monkeypatching introduced in #11610 has broken array_prototype.lastIndexOf()
- Svelte version @5.0.0-next.140 breaks Svelte-dnd-action HOT 9
- DOM does not update when using array of objects in $state.frozen() HOT 4
- Svelte 5: onanimationend event doesn't get called under these specific circumstances. HOT 1
- Svelte v5 (maybe v4 too?) incorrectly removes CSS selectors alleging they are unused HOT 9
- Disable paste rather then copy in the tutorial. HOT 2
- Immer JS doesn't work with svelte runes HOT 5
- 5.0.0-next.138 breaks nested global CSS-attribute selectors
- 5.0.0-next.140 blocks pre-render capabilities of $effect.pre() HOT 6
- Svelte action update doesn't trigger on classes HOT 4
- Svelte 5: CSS custom property wrapper is implemented incorrectly HOT 5
- svelte 5: gotpointercapture and lostpointercapture not paresed correctly
- Anchor Tags Triggering Old URLs in Android Chrome HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svelte.